Annotation of embedaddon/php/ext/dom/tests/DOMNode_hasChildNodes.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Tests DOMNode::hasChildNodes()
        !             3: --CREDITS--
        !             4: Michael Stillwell <mjs@beebo.org>
        !             5: # TestFest 2008
        !             6: --SKIPIF--
        !             7: <?php require_once('skipif.inc'); ?>
        !             8: --FILE--
        !             9: <?php
        !            10: 
        !            11: $dom = new DOMDocument();
        !            12: 
        !            13: $dom->loadXML('<root/>');
        !            14: 
        !            15: echo $dom->saveXML();
        !            16: 
        !            17: echo "Document has child nodes\n";
        !            18: var_dump($dom->documentElement->hasChildNodes());
        !            19: 
        !            20: echo "Document has child nodes\n";
        !            21: $dom->loadXML('<root><a/></root>');
        !            22: var_dump($dom->documentElement->hasChildNodes());
        !            23: 
        !            24: echo "Remove node and save\n";
        !            25: $dom->documentElement->removeChild($dom->documentElement->firstChild);
        !            26: echo $dom->saveXML();
        !            27: 
        !            28: echo "Document has child nodes\n";
        !            29: var_dump($dom->documentElement->hasChildNodes());
        !            30: 
        !            31: echo "Document with 2 child nodes\n";
        !            32: $dom->loadXML('<root><a/><b/></root>');
        !            33: var_dump($dom->documentElement->hasChildNodes());
        !            34: 
        !            35: ?>
        !            36: --EXPECTF--
        !            37: <?xml version="1.0"?>
        !            38: <root/>
        !            39: Document has child nodes
        !            40: bool(false)
        !            41: Document has child nodes
        !            42: bool(true)
        !            43: Remove node and save
        !            44: <?xml version="1.0"?>
        !            45: <root/>
        !            46: Document has child nodes
        !            47: bool(false)
        !            48: Document with 2 child nodes
        !            49: bool(true)

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