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