Annotation of embedaddon/php/ext/standard/tests/class_object/get_class_variation_001.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test get_class() function : usage variations - passing unexpected types.
3: --FILE--
4: <?php
5: /* Prototype : proto string get_class([object object])
6: * Description: Retrieves the class name
7: * Source code: Zend/zend_builtin_functions.c
8: * Alias to functions:
9: */
10:
11: echo "*** Testing get_class() : usage variations ***\n";
12:
13: // Note: basic use cases in Zend/tests/009.phpt
14:
15: //get an unset variable
16: $unset_var = 10;
17: unset ($unset_var);
18:
19: //array of values to iterate over
20: $values = array(
21:
22: // int data
23: 0,
24: 1,
25: 12345,
26: -2345,
27:
28: // float data
29: 10.5,
30: -10.5,
31: 10.1234567e10,
32: 10.7654321E-10,
33: .5,
34:
35: // array data
36: array(),
37: array(0),
38: array(1),
39: array(1, 2),
40: array('color' => 'red', 'item' => 'pen'),
41:
42: // null data
43: NULL,
44: null,
45:
46: // boolean data
47: true,
48: false,
49: TRUE,
50: FALSE,
51:
52: // empty data
53: "",
54: '',
55:
56: // string data
57: "string",
58: 'string',
59:
60: // undefined data
61: $undefined_var,
62:
63: // unset data
64: $unset_var,
65: );
66:
67: // loop through each element of the array for object
68:
69: foreach($values as $value) {
1.1.1.2 ! misho 70: echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
1.1 misho 71: var_dump( get_class($value) );
72: };
73:
74: echo "Done";
75: ?>
76: --EXPECTF--
77: *** Testing get_class() : usage variations ***
78:
79: Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58
80:
81: Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61
82:
83: Arg value: 0 (type: integer)
84:
85: Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d
86: bool(false)
87:
88: Arg value: 1 (type: integer)
89:
90: Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d
91: bool(false)
92:
93: Arg value: 12345 (type: integer)
94:
95: Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d
96: bool(false)
97:
98: Arg value: -2345 (type: integer)
99:
100: Warning: get_class() expects parameter 1 to be object, integer given in %sget_class_variation_001.php on line %d
101: bool(false)
102:
103: Arg value: 10.5 (type: double)
104:
105: Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d
106: bool(false)
107:
108: Arg value: -10.5 (type: double)
109:
110: Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d
111: bool(false)
112:
113: Arg value: 101234567000 (type: double)
114:
115: Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d
116: bool(false)
117:
118: Arg value: 1.07654321E-9 (type: double)
119:
120: Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d
121: bool(false)
122:
123: Arg value: 0.5 (type: double)
124:
125: Warning: get_class() expects parameter 1 to be object, double given in %sget_class_variation_001.php on line %d
126: bool(false)
127:
128: Arg value: Array (type: array)
129:
130: Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
131: bool(false)
132:
133: Arg value: Array (type: array)
134:
135: Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
136: bool(false)
137:
138: Arg value: Array (type: array)
139:
140: Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
141: bool(false)
142:
143: Arg value: Array (type: array)
144:
145: Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
146: bool(false)
147:
148: Arg value: Array (type: array)
149:
150: Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
151: bool(false)
152:
153: Arg value: (type: NULL)
154:
155: Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
156: bool(false)
157:
158: Arg value: (type: NULL)
159:
160: Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
161: bool(false)
162:
163: Arg value: 1 (type: boolean)
164:
165: Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d
166: bool(false)
167:
168: Arg value: (type: boolean)
169:
170: Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d
171: bool(false)
172:
173: Arg value: 1 (type: boolean)
174:
175: Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d
176: bool(false)
177:
178: Arg value: (type: boolean)
179:
180: Warning: get_class() expects parameter 1 to be object, boolean given in %sget_class_variation_001.php on line %d
181: bool(false)
182:
183: Arg value: (type: string)
184:
185: Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
186: bool(false)
187:
188: Arg value: (type: string)
189:
190: Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
191: bool(false)
192:
193: Arg value: string (type: string)
194:
195: Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
196: bool(false)
197:
198: Arg value: string (type: string)
199:
200: Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
201: bool(false)
202:
203: Arg value: (type: NULL)
204:
205: Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
206: bool(false)
207:
208: Arg value: (type: NULL)
209:
210: Warning: get_class() called without object from outside a class in %sget_class_variation_001.php on line %d
211: bool(false)
212: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>