1--TEST--
2Dom\Node::getRootNode()
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8// Same as DOMNode_getRootNode.phpt but for modern DOM
9
10$dom = Dom\XMLDocument::createFromString('<?xml version="1.0"?><html><body/></html>');
11
12var_dump($dom->documentElement->firstElementChild->getRootNode() === $dom);
13$p = $dom->createElement('p');
14var_dump($p->getRootNode() === $p);
15$dom->documentElement->appendChild($p);
16var_dump($p->getRootNode() === $dom);
17$dom->documentElement->remove();
18var_dump($p->getRootNode() === $p);
19
20$fragment = $dom->createDocumentFragment();
21var_dump($fragment->getRootNode() === $fragment);
22$div = $fragment->appendChild($dom->createElement('div'));
23$div->appendChild($p);
24var_dump($p->getRootNode() === $fragment);
25
26?>
27--EXPECT--
28bool(true)
29bool(true)
30bool(true)
31bool(true)
32bool(true)
33bool(true)
34