Annotation of embedaddon/php/ext/simplexml/tests/feature55218.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #55218 getDocNamespaces from current element and not root
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded("simplexml")) print "skip SimpleXML not present";
                      6: if (!extension_loaded("libxml")) print "skip LibXML not present";
                      7: ?>
                      8: --FILE--
                      9: <?php 
                     10: 
                     11: $x = new SimpleXMLElement(
                     12: '<?xml version="1.0" standalone="yes"?>
                     13: <people xmlns:p="http://example.org/p" >
                     14:     <person id="1" xmlns:t="http://example.org/t" >
                     15:                 <t:name>John Doe</t:name>
                     16:         </person>
                     17:     <person id="2">Susie Q. Public</person>
                     18:     <o>
                     19:                 <p:div>jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk</p:div>
                     20:         </o>
                     21: </people>');
                     22: 
                     23: echo "getDocNamespaces\n";
                     24: echo "\nBackwards Compatibility:\n";
                     25: echo "recursion:\n";
                     26: 
                     27: var_dump ( $x->getDocNamespaces(true) ) ;
                     28: var_dump( $x->person[0]->getDocNamespaces(true) );
                     29: var_dump( $x->person[1]->getDocNamespaces(true) );
                     30: 
                     31: echo "\nnon recursive:\n";
                     32: 
                     33: var_dump( $x->getDocNamespaces(false) );
                     34: var_dump( $x->person[0]->getDocNamespaces(false) );
                     35: var_dump( $x->person[1]->getDocNamespaces(false) );
                     36: 
                     37: echo "\n\nUsing new 'from_root' bool set to false:\n";
                     38: echo "recursion:\n";
                     39: 
                     40: var_dump ( $x->getDocNamespaces(true, false) ) ;
                     41: var_dump( $x->person[0]->getDocNamespaces(true, false) );
                     42: var_dump( $x->person[1]->getDocNamespaces(true, false) );
                     43: 
                     44: echo "\nnon recursive:\n";
                     45: 
                     46: var_dump( $x->getDocNamespaces(false, false) );
                     47: var_dump( $x->person[0]->getDocNamespaces(false, false) );
                     48: var_dump( $x->person[1]->getDocNamespaces(false, false) );
                     49: 
                     50: ?>
                     51: ===DONE===
                     52: --EXPECTF--
                     53: getDocNamespaces
                     54: 
                     55: Backwards Compatibility:
                     56: recursion:
                     57: array(2) {
                     58:   ["p"]=>
                     59:   string(20) "http://example.org/p"
                     60:   ["t"]=>
                     61:   string(20) "http://example.org/t"
                     62: }
                     63: array(2) {
                     64:   ["p"]=>
                     65:   string(20) "http://example.org/p"
                     66:   ["t"]=>
                     67:   string(20) "http://example.org/t"
                     68: }
                     69: array(2) {
                     70:   ["p"]=>
                     71:   string(20) "http://example.org/p"
                     72:   ["t"]=>
                     73:   string(20) "http://example.org/t"
                     74: }
                     75: 
                     76: non recursive:
                     77: array(1) {
                     78:   ["p"]=>
                     79:   string(20) "http://example.org/p"
                     80: }
                     81: array(1) {
                     82:   ["p"]=>
                     83:   string(20) "http://example.org/p"
                     84: }
                     85: array(1) {
                     86:   ["p"]=>
                     87:   string(20) "http://example.org/p"
                     88: }
                     89: 
                     90: 
                     91: Using new 'from_root' bool set to false:
                     92: recursion:
                     93: array(2) {
                     94:   ["p"]=>
                     95:   string(20) "http://example.org/p"
                     96:   ["t"]=>
                     97:   string(20) "http://example.org/t"
                     98: }
                     99: array(1) {
                    100:   ["t"]=>
                    101:   string(20) "http://example.org/t"
                    102: }
                    103: array(0) {
                    104: }
                    105: 
                    106: non recursive:
                    107: array(1) {
                    108:   ["p"]=>
                    109:   string(20) "http://example.org/p"
                    110: }
                    111: array(1) {
                    112:   ["t"]=>
                    113:   string(20) "http://example.org/t"
                    114: }
                    115: array(0) {
                    116: }
                    117: ===DONE===

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