1--TEST--
2Dom\HTMLDocument::createFromString() with LIBXML_HTML_NOIMPLIED namespace check
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8echo "--- No elements ---\n";
9
10$dom = Dom\HTMLDocument::createFromString("", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
11echo $dom->saveXml(), "\n";
12
13echo "--- Single element ---\n";
14
15$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
16echo $dom->saveXml(), "\n";
17var_dump($dom->documentElement->namespaceURI);
18var_dump($dom->documentElement->prefix);
19
20echo "--- Multiple elements ---\n";
21
22$dom = Dom\HTMLDocument::createFromString("<p>foo</p><strong>bar</strong>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
23echo $dom->saveXml(), "\n";
24var_dump($dom->documentElement->namespaceURI);
25var_dump($dom->documentElement->prefix);
26var_dump($dom->documentElement->nextSibling->namespaceURI);
27var_dump($dom->documentElement->nextSibling->prefix);
28
29?>
30--EXPECT--
31--- No elements ---
32<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
33
34--- Single element ---
35<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
36<p xmlns="http://www.w3.org/1999/xhtml">foo</p>
37string(28) "http://www.w3.org/1999/xhtml"
38NULL
39--- Multiple elements ---
40<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
41<p xmlns="http://www.w3.org/1999/xhtml">foo</p><strong xmlns="http://www.w3.org/1999/xhtml">bar</strong>
42string(28) "http://www.w3.org/1999/xhtml"
43NULL
44string(28) "http://www.w3.org/1999/xhtml"
45NULL
46