split off pecl_http
[m6w6/ext-json_post] / tests / 002.phpt
diff --git a/tests/002.phpt b/tests/002.phpt
new file mode 100644 (file)
index 0000000..643f560
--- /dev/null
@@ -0,0 +1,67 @@
+--TEST--
+json_post
+--SKIPIF--
+<?php
+extension_loaded("json_post")) or die("skip need json_post support\n");
+?>
+--INI--
+json_post.flags=2;JSON_BIGINT_AS_STRING
+--POST_RAW--
+Content-type: text/json
+
+{
+       "null": null,
+       "bool": true,
+       "int": 123,
+       "bigint": 36893488147419103232,
+       "float": 123.123,
+       "string": "Hello World",
+       "array": [1,2,3],
+       "object": {
+               "array": [1,2,3],
+               "unicode": "\u00D6sterreich"
+       }
+}
+--FILE--
+<?php
+var_dump($_POST, json_last_error_msg());
+?>
+--EXPECTF--
+object(stdClass)#%d (8) {
+  ["null"]=>
+  NULL
+  ["bool"]=>
+  bool(true)
+  ["int"]=>
+  int(123)
+  ["bigint"]=>
+  string(20) "36893488147419103232"
+  ["float"]=>
+  float(123.123)
+  ["string"]=>
+  string(11) "Hello World"
+  ["array"]=>
+  array(3) {
+    [0]=>
+    int(1)
+    [1]=>
+    int(2)
+    [2]=>
+    int(3)
+  }
+  ["object"]=>
+  object(stdClass)#%d (2) {
+    ["array"]=>
+    array(3) {
+      [0]=>
+      int(1)
+      [1]=>
+      int(2)
+      [2]=>
+      int(3)
+    }
+    ["unicode"]=>
+    string(11) "Österreich"
+  }
+}
+string(8) "No error"
\ No newline at end of file