php-src/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
Max Semenik bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00

42 lines
830 B
PHP

--TEST--
Test whether a node has child nodes: hasChildNodes()
--EXTENSIONS--
dom
--FILE--
<?php
/* Create an XML document
* with structure
* <book>
* <title>This is the title</title>
* </book>
* Check for child nodes of the <book>, <title> and This is the title
*
*/
$doc = new DOMDocument();
$root = $doc->createElement('book');
$doc->appendChild($root);
$title = $doc->createElement('title');
$root->appendChild($title);
$text = $doc->createTextNode('This is the title');
$title->appendChild($text);
echo "Root has child nodes: ";
var_dump($root->hasChildNodes());
echo "Title has child nodes: ";
var_dump($title->hasChildNodes());
echo "Text has child nodes: ";
var_dump($text->hasChildNodes());
?>
--EXPECT--
Root has child nodes: bool(true)
Title has child nodes: bool(true)
Text has child nodes: bool(false)