1--TEST-- 2Element::insertAdjacentElement() 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\XMLDocument::createFromString('<?xml version="1.0"?><container><p>foo</p></container>'); 9$container = $dom->documentElement; 10$p = $container->firstElementChild; 11 12var_dump($p->insertAdjacentElement(Dom\AdjacentPosition::BeforeBegin, $dom->createElement('A'))->tagName); 13echo $dom->saveXML(), "\n"; 14 15var_dump($p->insertAdjacentElement(Dom\AdjacentPosition::AfterBegin, $dom->createElement('B'))->tagName); 16echo $dom->saveXML(), "\n"; 17 18var_dump($p->insertAdjacentElement(Dom\AdjacentPosition::BeforeEnd, $dom->createElement('C'))->tagName); 19echo $dom->saveXML(), "\n"; 20 21var_dump($p->insertAdjacentElement(Dom\AdjacentPosition::AfterEnd, $dom->createElement('D'))->tagName); 22echo $dom->saveXML(), "\n"; 23 24?> 25--EXPECT-- 26string(1) "A" 27<?xml version="1.0" encoding="UTF-8"?> 28<container><A/><p>foo</p></container> 29string(1) "B" 30<?xml version="1.0" encoding="UTF-8"?> 31<container><A/><p><B/>foo</p></container> 32string(1) "C" 33<?xml version="1.0" encoding="UTF-8"?> 34<container><A/><p><B/>foo<C/></p></container> 35string(1) "D" 36<?xml version="1.0" encoding="UTF-8"?> 37<container><A/><p><B/>foo<C/></p><D/></container> 38