alan_k Tue, 27 Sep 2011 00:42:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=317365
Log:
fix is_a errror test so they test correctly against new behaviour of is_a and
is_subclass_of
Changed paths:
U
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.phpt
U
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
Modified:
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.phpt
===================================================================
---
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.phpt
2011-09-27 00:19:43 UTC (rev 317364)
+++
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_a_error_001.phpt
2011-09-27 00:42:56 UTC (rev 317365)
@@ -4,7 +4,7 @@
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,14 +12,20 @@
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";
$object = new stdclass();
@@ -28,15 +34,21 @@
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
Modified:
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
===================================================================
---
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
2011-09-27 00:19:43 UTC (rev 317364)
+++
php/php-src/branches/PHP_5_3/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
2011-09-27 00:42:56 UTC (rev 317365)
@@ -15,9 +15,19 @@
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";
$object = new stdclass();
@@ -30,11 +40,19 @@
-- 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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php