Annotation of embedaddon/php/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test is_subclass_of() function : usage variations - unexpected type for arg 1
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: // Note: basic use cases in Zend/tests/is_a.phpt
11: function __autoload($className) {
12: echo "In __autoload($className)\n";
13: }
14:
15: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
16: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
17: }
18: set_error_handler('test_error_handler');
19:
20:
21: echo "*** Testing is_subclass_of() : usage variations ***\n";
22:
23: // Initialise function arguments not being substituted (if any)
24: $class_name = 'string_val';
25:
26: //get an unset variable
27: $unset_var = 10;
28: unset ($unset_var);
29:
30: //array of values to iterate over
31: $values = array(
32:
33: // int data
34: 0,
35: 1,
36: 12345,
37: -2345,
38:
39: // float data
40: 10.5,
41: -10.5,
42: 10.1234567e10,
43: 10.7654321E-10,
44: .5,
45:
46: // array data
47: array(),
48: array(0),
49: array(1),
50: array(1, 2),
51: array('color' => 'red', 'item' => 'pen'),
52:
53: // null data
54: NULL,
55: null,
56:
57: // boolean data
58: true,
59: false,
60: TRUE,
61: FALSE,
62:
63: // empty data
64: "",
65: '',
66:
67: // string data
68: "string",
69: 'String',
70:
71: // undefined data
72: $undefined_var,
73:
74: // unset data
75: $unset_var,
76: );
77:
78: // loop through each element of the array for object
79:
80: foreach($values as $value) {
81: echo "\nArg value $value \n";
82: var_dump( is_subclass_of($value, $class_name) );
83: };
84:
85: echo "Done";
86: ?>
87: --EXPECTF--
88: *** Testing is_subclass_of() : usage variations ***
89: Error: 8 - Undefined variable: undefined_var, %s(69)
90: Error: 8 - Undefined variable: unset_var, %s(72)
91:
92: Arg value 0
93: bool(false)
94:
95: Arg value 1
96: bool(false)
97:
98: Arg value 12345
99: bool(false)
100:
101: Arg value -2345
102: bool(false)
103:
104: Arg value 10.5
105: bool(false)
106:
107: Arg value -10.5
108: bool(false)
109:
110: Arg value 101234567000
111: bool(false)
112:
113: Arg value 1.07654321E-9
114: bool(false)
115:
116: Arg value 0.5
117: bool(false)
1.1.1.2 ! misho 118: Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
1.1 misho 119:
120: Arg value Array
121: bool(false)
1.1.1.2 ! misho 122: Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
1.1 misho 123:
124: Arg value Array
125: bool(false)
1.1.1.2 ! misho 126: Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
1.1 misho 127:
128: Arg value Array
129: bool(false)
1.1.1.2 ! misho 130: Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
1.1 misho 131:
132: Arg value Array
133: bool(false)
1.1.1.2 ! misho 134: Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
1.1 misho 135:
136: Arg value Array
137: bool(false)
138:
139: Arg value
140: bool(false)
141:
142: Arg value
143: bool(false)
144:
145: Arg value 1
146: bool(false)
147:
148: Arg value
149: bool(false)
150:
151: Arg value 1
152: bool(false)
153:
154: Arg value
155: bool(false)
156:
157: Arg value
158: bool(false)
159:
160: Arg value
161: bool(false)
162:
163: Arg value string
164: In __autoload(string)
165: bool(false)
166:
167: Arg value String
168: In __autoload(String)
169: bool(false)
170:
171: Arg value
172: bool(false)
173:
174: Arg value
175: bool(false)
176: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>