1--TEST--
2Dom\Node::insertBefore() with DocumentFragment and a document element
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><head></head><body></body></html>');
9
10$fragment = $dom->createDocumentFragment();
11$fragment->appendChild($dom->createElement('a'));
12
13try {
14    $dom->insertBefore($fragment, $dom->documentElement);
15} catch (DOMException $e) {
16    echo $e->getMessage(), "\n";
17}
18
19echo $dom->saveHtml(), "\n";
20
21?>
22--EXPECT--
23Cannot have more than one element child in a document
24<!DOCTYPE html><html><head></head><body></body></html>
25