Annotation of embedaddon/php/ext/xml/tests/xml_parse_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test xml_parse() 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(resource parser, string data [, int isFinal])
                     12:  * Description: Start parsing an XML document 
                     13:  * Source code: ext/xml/xml.c
                     14:  * Alias to functions: 
                     15:  */
                     16: 
                     17: echo "*** Testing xml_parse() : error conditions ***\n";
                     18: 
                     19: 
                     20: //Test xml_parse with one more than the expected number of arguments
                     21: echo "\n-- Testing xml_parse() function with more than expected no. of arguments --\n";
                     22: 
                     23: $data = 'string_val';
                     24: $isFinal = false;
                     25: $extra_arg = 10;
                     26: var_dump( xml_parse(null, $data, $isFinal, $extra_arg) );
                     27: 
                     28: // Testing xml_parse with one less than the expected number of arguments
                     29: echo "\n-- Testing xml_parse() function with less than expected no. of arguments --\n";
                     30: 
                     31: var_dump( xml_parse(null) );
                     32: 
                     33: echo "Done";
                     34: ?>
                     35: --EXPECTF--
                     36: *** Testing xml_parse() : error conditions ***
                     37: 
                     38: -- Testing xml_parse() function with more than expected no. of arguments --
                     39: 
                     40: Warning: xml_parse() expects at most 3 parameters, 4 given in %s on line %d
                     41: NULL
                     42: 
                     43: -- Testing xml_parse() function with less than expected no. of arguments --
                     44: 
                     45: Warning: xml_parse() expects at least 2 parameters, 1 given in %s on line %d
                     46: NULL
                     47: Done
                     48: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>