Annotation of embedaddon/php/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test whether a node has child nodes: hasChildNodes()
3: --SKIPIF--
4: <?php
5: include('skipif.inc');
6: ?>
7: --FILE--
8: <?php
9:
10: /* Create an XML document
11: * with strcuture
12: * <book>
13: * <title>This is the title</title>
14: * </book>
15: * Check for child nodes of the <book>, <title> and This is the title
16: *
17: */
18:
19: $doc = new DOMDocument();
20:
21: $root = $doc->createElement('book');
22: $doc->appendChild($root);
23:
24: $title = $doc->createElement('title');
25: $root->appendChild($title);
26:
27: $text = $doc->createTextNode('This is the title');
28: $title->appendChild($text);
29:
30: echo "Root has child nodes: ";
31: var_dump($root->hasChildNodes());
32:
33: echo "Title has child nodes: ";
34: var_dump($title->hasChildNodes());
35:
36: echo "Text has child nodes: ";
37: var_dump($text->hasChildNodes());
38:
39: ?>
40: --EXPECTF--
41: Root has child nodes: bool(true)
42: Title has child nodes: bool(true)
43: Text has child nodes: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>