Skip to content

Commit f40459c

Browse files
committed
json test updates
1 parent bdaa18a commit f40459c

File tree

4 files changed

+15
-37
lines changed

4 files changed

+15
-37
lines changed

ext/json/tests/001.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ json_decode() tests
55
--FILE--
66
<?php
77

8-
var_dump(json_decode());
98
var_dump(json_decode(""));
109
var_dump(json_decode("", 1));
1110
var_dump(json_decode("", 0));
@@ -26,8 +25,6 @@ var_dump(json_decode('{ "": "": "" } }'));
2625
?>
2726
===DONE===
2827
--EXPECTF--
29-
Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
30-
NULL
3128
NULL
3229
NULL
3330
NULL

ext/json/tests/json_decode_error.phpt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ Test json_decode() function : error conditions
66
<?php
77
echo "*** Testing json_decode() : error conditions ***\n";
88

9-
echo "\n-- Testing json_decode() function with no arguments --\n";
10-
var_dump(json_decode());
11-
12-
echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n";
13-
$extra_arg = 10;
14-
var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
15-
169
echo "\n-- Testing json_decode() function with depth below 0 --\n";
1710
var_dump(json_decode('"abc"', true, -1));
1811

@@ -21,16 +14,6 @@ var_dump(json_decode('"abc"', true, -1));
2114
--EXPECTF--
2215
*** Testing json_decode() : error conditions ***
2316

24-
-- Testing json_decode() function with no arguments --
25-
26-
Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
27-
NULL
28-
29-
-- Testing json_decode() function with more than expected no. of arguments --
30-
31-
Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d
32-
NULL
33-
3417
-- Testing json_decode() function with depth below 0 --
3518

3619
Warning: json_decode(): Depth must be greater than zero in %s on line %d

ext/json/tests/json_last_error_error.phpt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ json_last_error() failures
66
<?php
77

88
var_dump(json_last_error());
9-
var_dump(json_last_error(true));
10-
var_dump(json_last_error('some', 4, 'args', 'here'));
9+
10+
try {
11+
var_dump(json_last_error(true));
12+
} catch (TypeError $e) {
13+
echo $e->getMessage(), "\n";
14+
}
1115

1216
?>
13-
--EXPECTF--
17+
--EXPECT--
1418
int(0)
15-
16-
Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
17-
NULL
18-
19-
Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
20-
NULL
19+
json_last_error() expects exactly 0 parameters, 1 given

ext/json/tests/json_last_error_msg_error.phpt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ json_last_error_msg() failures
66
<?php
77

88
var_dump(json_last_error_msg());
9-
var_dump(json_last_error_msg(true));
10-
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
9+
10+
try {
11+
var_dump(json_last_error_msg(true));
12+
} catch (TypeError $e) {
13+
echo $e->getMessage(), "\n";
14+
}
1115

1216
?>
1317
--EXPECTF--
1418
string(8) "No error"
15-
16-
Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
17-
NULL
18-
19-
Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
20-
NULL
19+
json_last_error_msg() expects exactly 0 parameters, 1 given

0 commit comments

Comments
 (0)