1--TEST--
2DOMChildNode methods without a parent
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = new DOMDocument;
8$doc->loadXML(<<<XML
9<?xml version="1.0"?>
10<container>
11    <child/>
12</container>
13XML);
14
15$container = $doc->documentElement;
16$child = $container->firstElementChild;
17
18$test = $doc->createElement('foo');
19foreach (['before', 'after', 'replaceWith'] as $method) {
20    echo "--- $method ---\n";
21    $test->$method($child);
22    echo $doc->saveXML();
23    echo $doc->saveXML($test), "\n";
24}
25?>
26--EXPECT--
27--- before ---
28<?xml version="1.0"?>
29<container>
30    <child/>
31</container>
32<foo/>
33--- after ---
34<?xml version="1.0"?>
35<container>
36    <child/>
37</container>
38<foo/>
39--- replaceWith ---
40<?xml version="1.0"?>
41<container>
42    <child/>
43</container>
44<foo/>
45