1--TEST--
2Test is_subclass_of() function : wrong number of args
3--FILE--
4<?php
5/* Prototype  : proto bool is_subclass_of(object object, string class_name)
6 * Description: Returns true if the object has this class as one of its parents
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11echo "*** Testing is_subclass_of() : error conditions ***\n";
12
13
14//Test is_subclass_of with one more than the expected number of arguments
15echo "\n-- Testing is_subclass_of() function with more than expected no. of arguments --\n";
16$object = new stdclass();
17$class_name = 'string_val';
18$allow_string = false;
19$extra_arg = 10;
20var_dump( is_subclass_of($object, $class_name, $allow_string, $extra_arg) );
21
22//Test is_subclass_of with invalid last argument
23echo "\n-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --\n";
24var_dump( is_subclass_of($object, $class_name, $class_name) );
25
26
27//Test is_subclass_of with invalid last argument
28echo "\n-- Testing is_subclass_of() function with more than invalid 3rd argument --\n";
29var_dump( is_subclass_of($object, $class_name, $object) );
30
31// Testing is_subclass_of with one less than the expected number of arguments
32echo "\n-- Testing is_subclass_of() function with less than expected no. of arguments --\n";
33$object = new stdclass();
34var_dump( is_subclass_of($object) );
35
36echo "Done";
37?>
38--EXPECTF--
39*** Testing is_subclass_of() : error conditions ***
40
41-- Testing is_subclass_of() function with more than expected no. of arguments --
42
43Warning: is_subclass_of() expects at most 3 parameters, 4 given in %s on line 17
44NULL
45
46-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --
47bool(false)
48
49-- Testing is_subclass_of() function with more than invalid 3rd argument --
50
51Warning: is_subclass_of() expects parameter 3 to be boolean, object given in %s on line 26
52NULL
53
54-- Testing is_subclass_of() function with less than expected no. of arguments --
55
56Warning: is_subclass_of() expects at least 2 parameters, 1 given in %s on line 31
57NULL
58Done
59