Annotation of embedaddon/php/ext/xml/tests/xml_parse_into_struct_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test xml_parse_into_struct() function : error conditions
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_parse_into_struct(resource parser, string data, array &struct, array &index)
12: * Description: Parsing a XML document
13: * Source code: ext/xml/xml.c
14: * Alias to functions:
15: */
16:
17: echo "*** Testing xml_parse_into_struct() : error conditions ***\n";
18:
19: //Test xml_parse_into_struct with one more than the expected number of arguments
20: echo "\n-- Testing xml_parse_into_struct() function with more than expected no. of arguments --\n";
21:
22: $data = 'string_val';
23: $struct = array(1, 2);
24: $index = array(1, 2);
25: $extra_arg = 10;
26: var_dump( xml_parse_into_struct(null, $data, $struct, $index, $extra_arg) );
27:
28: // Testing xml_parse_into_struct with one less than the expected number of arguments
29: echo "\n-- Testing xml_parse_into_struct() function with less than expected no. of arguments --\n";
30:
31: $data = 'string_val';
32: var_dump( xml_parse_into_struct(null, $data) );
33:
34: echo "Done";
35: ?>
36: --EXPECTF--
37: *** Testing xml_parse_into_struct() : error conditions ***
38:
39: -- Testing xml_parse_into_struct() function with more than expected no. of arguments --
40:
41: Warning: xml_parse_into_struct() expects at most 4 parameters, 5 given in %s on line %d
42: NULL
43:
44: -- Testing xml_parse_into_struct() function with less than expected no. of arguments --
45:
46: Warning: xml_parse_into_struct() expects at least 3 parameters, 2 given in %s on line %d
47: NULL
48: Done
49:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>