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