1--TEST-- 2Element::insertAdjacentText() edge cases 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\HTMLDocument::createEmpty(); 9$foo = $dom->appendChild($dom->createElement("foo")); 10try { 11 $foo->insertAdjacentText(Dom\AdjacentPosition::BeforeBegin, "bar"); 12} catch (DOMException $e) { 13 echo $e->getMessage(), "\n"; 14} 15 16$foo->insertAdjacentText(Dom\AdjacentPosition::AfterBegin, "bar"); 17$foo->insertAdjacentText(Dom\AdjacentPosition::BeforeEnd, "baz"); 18 19echo $dom->saveHtml(), "\n"; 20 21var_dump($foo->firstChild->textContent); 22var_dump($foo->firstChild->nextSibling->textContent); 23 24?> 25--EXPECT-- 26Cannot insert text as a child of a document 27<foo>barbaz</foo> 28string(3) "bar" 29string(3) "baz" 30