fix is_a errror test so they test correctly against new behaviour of is_a and is_subclass_of

This commit is contained in:
Alan Knowles 2011-09-27 00:42:56 +00:00
parent 779ca152bf
commit 60093a0ca5
2 changed files with 39 additions and 9 deletions

View File

@ -4,7 +4,7 @@ Test is_a() function : error conditions - wrong number of args
error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
/* Prototype : proto bool is_a(object object, string class_name)
/* Prototype : proto bool is_a(object object, string class_name, bool allow_string)
* Description: Returns true if the object is of this class or has this class as one of its parents
* Source code: Zend/zend_builtin_functions.c
* Alias to functions:
@ -12,13 +12,19 @@ error_reporting=E_ALL | E_STRICT | E_DEPRECATED
echo "*** Testing is_a() : error conditions ***\n";
//Test is_a with one more than the expected number of arguments
echo "\n-- Testing is_a() function with more than expected no. of arguments --\n";
$object = new stdclass();
$class_name = 'string_val';
$allow_string = false;
$extra_arg = 10;
var_dump( is_a($object, $class_name, $extra_arg) );
var_dump( is_a($object, $class_name, $allow_string, $object) );
//Test is_a with one more than the expected number of arguments
echo "\n-- Testing is_a() function with non-boolean in last position --\n";
var_dump( is_a($object, $class_name, $object) );
// Testing is_a with one less than the expected number of arguments
echo "\n-- Testing is_a() function with less than expected no. of arguments --\n";
@ -28,15 +34,21 @@ var_dump( is_a($object) );
echo "Done";
?>
--EXPECTF--
*** Testing is_a() : error conditions ***
-- Testing is_a() function with more than expected no. of arguments --
Warning: is_a() expects exactly 2 parameters, 3 given in %s on line 16
Warning: is_a() expects at most 3 parameters, 4 given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.php on line 17
NULL
-- Testing is_a() function with non-boolean in last position --
Warning: is_a() expects parameter 3 to be boolean, object given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.php on line 21
NULL
-- Testing is_a() function with less than expected no. of arguments --
Warning: is_a() expects exactly 2 parameters, 1 given in %s on line 21
Warning: is_a() expects at least 2 parameters, 1 given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.php on line 27
NULL
Done
Done

View File

@ -15,8 +15,18 @@ echo "*** Testing is_subclass_of() : error conditions ***\n";
echo "\n-- Testing is_subclass_of() function with more than expected no. of arguments --\n";
$object = new stdclass();
$class_name = 'string_val';
$allow_string = false;
$extra_arg = 10;
var_dump( is_subclass_of($object, $class_name, $extra_arg) );
var_dump( is_subclass_of($object, $class_name, $allow_string, $extra_arg) );
//Test is_subclass_of with invalid last argument
echo "\n-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --\n";
var_dump( is_subclass_of($object, $class_name, $class_name) );
//Test is_subclass_of with invalid last argument
echo "\n-- Testing is_subclass_of() function with more than invalid 3rd argument --\n";
var_dump( is_subclass_of($object, $class_name, $object) );
// Testing is_subclass_of with one less than the expected number of arguments
echo "\n-- Testing is_subclass_of() function with less than expected no. of arguments --\n";
@ -30,11 +40,19 @@ echo "Done";
-- Testing is_subclass_of() function with more than expected no. of arguments --
Warning: is_subclass_of() expects exactly 2 parameters, 3 given in %s on line 16
Warning: is_subclass_of() expects at most 3 parameters, 4 given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.php on line 17
NULL
-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --
bool(false)
-- Testing is_subclass_of() function with more than invalid 3rd argument --
Warning: is_subclass_of() expects parameter 3 to be boolean, object given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.php on line 26
NULL
-- Testing is_subclass_of() function with less than expected no. of arguments --
Warning: is_subclass_of() expects exactly 2 parameters, 1 given in %s on line 21
Warning: is_subclass_of() expects at least 2 parameters, 1 given in /home/alan/git/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.php on line 31
NULL
Done