Add tests for json_last_error()/json_last_error_msg() failures

This commit is contained in:
Kubo2 2015-07-20 13:05:44 +02:00 committed by Christoph M. Becker
parent e3a85074ed
commit f18ba0f9c9
2 changed files with 43 additions and 0 deletions

View 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

View 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