mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Add tests for json_last_error()/json_last_error_msg() failures
This commit is contained in:
parent
e3a85074ed
commit
f18ba0f9c9
2 changed files with 43 additions and 0 deletions
22
ext/json/tests/json_last_error_error.phpt
Normal file
22
ext/json/tests/json_last_error_error.phpt
Normal file
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
json_last_error() failures
|
||||
--SKIPIF--
|
||||
<?php !extension_loaded('json') && die('skip json extension not available') ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(json_last_error());
|
||||
var_dump(json_last_error(TRUE));
|
||||
var_dump(json_last_error('some', 4, 'args', 'here'));
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
|
||||
Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
|
21
ext/json/tests/json_last_error_msg_error.phpt
Normal file
21
ext/json/tests/json_last_error_msg_error.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
json_last_error_msg() failures
|
||||
--SKIPIF--
|
||||
<?php !extension_loaded('json') && die('skip json extension not available') ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(json_last_error_msg());
|
||||
var_dump(json_last_error_msg(TRUE));
|
||||
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(8) "No error"
|
||||
|
||||
Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue