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