1--TEST--
2Tests DOMNode::hasChildNodes()
3--CREDITS--
4Michael 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
15echo $dom->saveXML();
16
17echo "Document has child nodes\n";
18var_dump($dom->documentElement->hasChildNodes());
19
20echo "Document has child nodes\n";
21$dom->loadXML('<root><a/></root>');
22var_dump($dom->documentElement->hasChildNodes());
23
24echo "Remove node and save\n";
25$dom->documentElement->removeChild($dom->documentElement->firstChild);
26echo $dom->saveXML();
27
28echo "Document has child nodes\n";
29var_dump($dom->documentElement->hasChildNodes());
30
31echo "Document with 2 child nodes\n";
32$dom->loadXML('<root><a/><b/></root>');
33var_dump($dom->documentElement->hasChildNodes());
34
35?>
36--EXPECTF--
37<?xml version="1.0"?>
38<root/>
39Document has child nodes
40bool(false)
41Document has child nodes
42bool(true)
43Remove node and save
44<?xml version="1.0"?>
45<root/>
46Document has child nodes
47bool(false)
48Document with 2 child nodes
49bool(true)
50