]> granicus.if.org Git - php/commitdiff
fix is_a errror test so they test correctly against new behaviour of is_a and is_subc...
authorAlan Knowles <alan_k@php.net>
Tue, 27 Sep 2011 00:42:56 +0000 (00:42 +0000)
committerAlan Knowles <alan_k@php.net>
Tue, 27 Sep 2011 00:42:56 +0000 (00:42 +0000)
ext/standard/tests/class_object/is_a_error_001.phpt
ext/standard/tests/class_object/is_subclass_of_error_001.phpt

index 921e3a26064a67f2daef4f7a4ccff83aa13707de..06674bc6a151b0429d3b970b7dad19156e6f7766 100644 (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
\ No newline at end of file
index bc657866d0f27137ba00b69e24cab642ad3139d4..f3ab9f30652a074db6b410acb89adfbe3d350144 100644 (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