projects
/
m6w6
/
ext-json_post
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
JSON_POST_ERROR, json_post.onerror.* INI, warning
[m6w6/ext-json_post]
/
tests
/
error005.phpt
diff --git
a/tests/error005.phpt
b/tests/error005.phpt
index aeea867dea0cce62de19717ddeb90871ad7a644f..97c4988d0601a280dc808b9a4511f769f7a39bce 100644
(file)
--- a/
tests/error005.phpt
+++ b/
tests/error005.phpt
@@
-1,31
+1,24
@@
--TEST--
--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) die("skip need PHP-7.0+\n");
-?>
+json_post with malformed JSON [response override] (https://github.com/m6w6/ext-json_post/issues/3)
+--EXTENSIONS--
+json_post
--INI--
--INI--
-json_post.error_response = 444
-json_post.flags = 1
+json_post.onerror.response = 444
--POST_RAW--
Content-Type: application/json
--POST_RAW--
Content-Type: application/json
-{
- "greeting": "Hello World
-}
+{"a
--FILE--
<?php
--FILE--
<?php
-http_response_code(400);
-
var_dump($_POST
);
-
var_dump(http_response_code())
;
+if (JSON_POST_ERROR)
+
http_response_code(400
);
+
include "./error.inc"
;
?>
?>
-Done
--EXPECTHEADERS--
Status: 400 Bad Request
--EXPECTHEADERS--
Status: 400 Bad Request
-X-JSON-Error-Code: 3
---EXPECTF--
-array(0) {
+--EXPECT--
+array(1) {
+ ["http_response_code"]=>
+ int(400)
}
}
-int(400)
-Done
+DONE