Annotation of embedaddon/php/ext/xml/tests/xml_set_object_variation2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test xml_set_object() function : usage variations
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("xml")) {
6: print "skip - XML extension not loaded";
7: }
8: ?>
9: --FILE--
10: <?php
11: /* Prototype : proto int xml_set_object(resource parser, object &obj)
12: * Description: Set up object which should be used for callbacks
13: * Source code: ext/xml/xml.c
14: * Alias to functions:
15: */
16:
17: echo "*** Testing xml_set_object() : usage variations ***\n";
18: error_reporting(E_ALL & ~E_NOTICE);
19: // Initialise function arguments not being substituted (if any)
20:
21: $parser = xml_parser_create();
22: $fp = fopen(__FILE__, "r");
23:
24:
25: //get an unset variable
26: $unset_var = 10;
27: unset ($unset_var);
28:
29: //array of values to iterate over
30: $values = array(
31:
32: // int data
33: 0,
34: 1,
35: 12345,
36: -2345,
37:
38: // float data
39: 10.5,
40: -10.5,
41: 10.1234567e10,
42: 10.7654321E-10,
43: .5,
44:
45: // array data
46: array(),
47: array(0),
48: array(1),
49: array(1, 2),
50: array('color' => 'red', 'item' => 'pen'),
51:
52: // null data
53: NULL,
54: null,
55:
56: // boolean data
57: true,
58: false,
59: TRUE,
60: FALSE,
61:
62: // empty data
63: "",
64: '',
65:
66: // string data
67: "string",
68: 'string',
69:
70: // resource data
71: $fp,
72:
73: // undefined data
74: $undefined_var,
75:
76: // unset data
77: $unset_var,
78: );
79:
80: // loop through each element of the array for obj
81:
82: foreach($values as $value) {
83: echo "\nArg value $value \n";
84: var_dump( xml_set_object($parser, $value) );
85: };
86:
87: xml_parser_free($parser);
88: fclose($fp);
89:
90: echo "Done";
91: ?>
92: --EXPECTF--
93: *** Testing xml_set_object() : usage variations ***
94:
95: Arg value 0
96:
97: Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d
98: NULL
99:
100: Arg value 1
101:
102: Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d
103: NULL
104:
105: Arg value 12345
106:
107: Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d
108: NULL
109:
110: Arg value -2345
111:
112: Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d
113: NULL
114:
115: Arg value 10.5
116:
117: Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d
118: NULL
119:
120: Arg value -10.5
121:
122: Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d
123: NULL
124:
125: Arg value 101234567000
126:
127: Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d
128: NULL
129:
130: Arg value 1.07654321E-9
131:
132: Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d
133: NULL
134:
135: Arg value 0.5
136:
137: Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d
138: NULL
139:
140: Arg value Array
141:
142: Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d
143: NULL
144:
145: Arg value Array
146:
147: Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d
148: NULL
149:
150: Arg value Array
151:
152: Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d
153: NULL
154:
155: Arg value Array
156:
157: Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d
158: NULL
159:
160: Arg value Array
161:
162: Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d
163: NULL
164:
165: Arg value
166:
167: Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d
168: NULL
169:
170: Arg value
171:
172: Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d
173: NULL
174:
175: Arg value 1
176:
177: Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d
178: NULL
179:
180: Arg value
181:
182: Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d
183: NULL
184:
185: Arg value 1
186:
187: Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d
188: NULL
189:
190: Arg value
191:
192: Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d
193: NULL
194:
195: Arg value
196:
197: Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d
198: NULL
199:
200: Arg value
201:
202: Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d
203: NULL
204:
205: Arg value string
206:
207: Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d
208: NULL
209:
210: Arg value string
211:
212: Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d
213: NULL
214:
215: Arg value Resource id %s
216:
217: Warning: xml_set_object() expects parameter 2 to be object, resource given in %s on line %d
218: NULL
219:
220: Arg value
221:
222: Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d
223: NULL
224:
225: Arg value
226:
227: Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d
228: NULL
229: Done
230:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>