mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
23ba4cde53
Closes GH-11905.
45 lines
751 B
PHP
45 lines
751 B
PHP
--TEST--
|
|
DOMChildNode methods without a parent
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$doc = new DOMDocument;
|
|
$doc->loadXML(<<<XML
|
|
<?xml version="1.0"?>
|
|
<container>
|
|
<child/>
|
|
</container>
|
|
XML);
|
|
|
|
$container = $doc->documentElement;
|
|
$child = $container->firstElementChild;
|
|
|
|
$test = $doc->createElement('foo');
|
|
foreach (['before', 'after', 'replaceWith'] as $method) {
|
|
echo "--- $method ---\n";
|
|
$test->$method($child);
|
|
echo $doc->saveXML();
|
|
echo $doc->saveXML($test), "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
--- before ---
|
|
<?xml version="1.0"?>
|
|
<container>
|
|
<child/>
|
|
</container>
|
|
<foo/>
|
|
--- after ---
|
|
<?xml version="1.0"?>
|
|
<container>
|
|
<child/>
|
|
</container>
|
|
<foo/>
|
|
--- replaceWith ---
|
|
<?xml version="1.0"?>
|
|
<container>
|
|
<child/>
|
|
</container>
|
|
<foo/>
|