diff options
author | Jakub Zelenka <bukka@php.net> | 2015-11-15 19:06:09 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2015-11-15 19:06:09 +0000 |
commit | e5abc53701ba5a9b58dfaba3b59881c9c410a8e7 (patch) | |
tree | cd52561b00721a80f3af32a3db28a716c5398175 /ext/json/tests/json_decode_basic.phpt | |
parent | f8bf9bd86bdeef33a48e43d772d8a25a4fe3e6ff (diff) | |
download | php-git-e5abc53701ba5a9b58dfaba3b59881c9c410a8e7.tar.gz |
Use the same CS for all json tests
Diffstat (limited to 'ext/json/tests/json_decode_basic.phpt')
-rw-r--r-- | ext/json/tests/json_decode_basic.phpt | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt index 6dbeadb367..0bc939c257 100644 --- a/ext/json/tests/json_decode_basic.phpt +++ b/ext/json/tests/json_decode_basic.phpt @@ -1,50 +1,41 @@ --TEST-- Test json_decode() function : basic functionality --SKIPIF-- -<?php -if (!extension_loaded("json")) { - die('skip JSON extension not available in this build'); -} -?> +<?php if (!extension_loaded("json")) print "skip"; ?> --FILE-- <?php -/* Prototype : mixed json_decode ( string $json [, bool $assoc ] ) - * Description: Decodes a JSON string - * Source code: ext/json/php_json.c - * Alias to functions: - */ echo "*** Testing json_decode() : basic functionality ***\n"; // array with different values for $string $inputs = array ( - '0', - '123', - '-123', - '2147483647', - '-2147483648', - '123.456', - '1230', - '-1230', - 'true', - 'false', - 'null', - '"abc"', - '"Hello World\r\n"', - '[]', - '[1,2,3,4,5]', - '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}', - '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}', - '""', - '{}' + '0', + '123', + '-123', + '2147483647', + '-2147483648', + '123.456', + '1230', + '-1230', + 'true', + 'false', + 'null', + '"abc"', + '"Hello World\r\n"', + '[]', + '[1,2,3,4,5]', + '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}', + '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}', + '""', + '{}' ); // loop through with each element of the $inputs array to test json_decode() function $count = 1; foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(json_decode($input)); - var_dump(json_decode($input, TRUE)); - $count ++; + echo "-- Iteration $count --\n"; + var_dump(json_decode($input)); + var_dump(json_decode($input, true)); + $count++; } ?> |