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

1.1       misho       1: --TEST--
                      2: Test xml_set_object() 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_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() : error conditions ***\n";
                     18: 
                     19: 
                     20: //Test xml_set_object with one more than the expected number of arguments
                     21: echo "\n-- Testing xml_set_object() function with more than expected no. of arguments --\n";
                     22: 
                     23: //WARNING: Unable to initialise parser of type resource
                     24: 
                     25: $obj = new stdclass();
                     26: $extra_arg = 10;
                     27: var_dump( xml_set_object(null, $obj, $extra_arg) );
                     28: 
                     29: // Testing xml_set_object with one less than the expected number of arguments
                     30: echo "\n-- Testing xml_set_object() function with less than expected no. of arguments --\n";
                     31: 
                     32: //WARNING: Unable to initialise parser of type resource
                     33: 
                     34: var_dump( xml_set_object(null) );
                     35: 
                     36: echo "Done";
                     37: ?>
                     38: --EXPECTF--
                     39: *** Testing xml_set_object() : error conditions ***
                     40: 
                     41: -- Testing xml_set_object() function with more than expected no. of arguments --
                     42: 
                     43: Warning: xml_set_object() expects exactly 2 parameters, 3 given in %s on line %d
                     44: NULL
                     45: 
                     46: -- Testing xml_set_object() function with less than expected no. of arguments --
                     47: 
                     48: Warning: xml_set_object() expects exactly 2 parameters, 1 given in %s on line %d
                     49: NULL
                     50: Done
                     51: 

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