add another test
authorMichael Wallner <mike@php.net>
Thu, 16 Sep 2021 11:52:33 +0000 (13:52 +0200)
committerMichael Wallner <mike@php.net>
Thu, 16 Sep 2021 11:52:33 +0000 (13:52 +0200)
tests/error005.phpt [new file with mode: 0644]

diff --git a/tests/error005.phpt b/tests/error005.phpt
new file mode 100644 (file)
index 0000000..748374a
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+json_post with malformed JSON (https://github.com/m6w6/ext-json_post/issues/3)
+--SKIPIF--
+<?php
+extension_loaded("json_post") or die("skip need json_post support\n");
+if (PHP_VERSION_ID < 70000) doe("skip need PHP-7.0+\n");
+?>
+--INI--
+json_post.error_response = 444
+json_post.flags = 1
+--POST_RAW--
+Content-Type: application/json
+
+{
+       "greeting": "Hello World
+}
+--FILE--
+<?php
+http_response_code(400);
+var_dump($_POST);
+var_dump(http_response_code());
+?>
+Done
+--EXPECTHEADERS--
+Status: 400 Bad Request
+X-JSON-Error-Code: 3
+--EXPECTF--
+array(0) {
+}
+int(400)
+Done