1--TEST--
2Document::$implementation createDocument
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\XMLDocument::createEmpty();
9
10echo "--- (null, \"\") ---\n";
11
12var_dump($dom->implementation->createDocument(null, ""));
13
14echo "--- (null, \"qname\") ---\n";
15
16echo $dom->implementation->createDocument(null, "qname")->saveXML(), "\n";
17
18echo "--- (\"\", \"qname\") ---\n";
19
20echo $dom->implementation->createDocument("", "qname")->saveXML(), "\n";
21
22echo "--- (\"urn:a\", \"qname\") ---\n";
23
24echo $dom->implementation->createDocument("urn:a", "qname")->saveXML(), "\n";
25
26echo "--- With doctype ---\n";
27
28$dtd = $dom->implementation->createDocumentType("mydoc", "", "");
29echo $dom->implementation->createDocument(null, "", $dtd)->saveXML(), "\n";
30
31echo "--- With auto-adopting doctype ---\n";
32
33$dom2 = DOM\XMLDocument::createEmpty();
34$dtd = $dom2->implementation->createDocumentType("mydoc", "", "");
35echo $dom->implementation->createDocument(null, "", $dtd)->saveXML(), "\n";
36
37?>
38--EXPECT--
39--- (null, "") ---
40object(DOM\XMLDocument)#3 (29) {
41  ["xmlEncoding"]=>
42  string(5) "UTF-8"
43  ["xmlStandalone"]=>
44  bool(false)
45  ["xmlVersion"]=>
46  string(3) "1.0"
47  ["formatOutput"]=>
48  bool(false)
49  ["implementation"]=>
50  string(22) "(object value omitted)"
51  ["URL"]=>
52  string(11) "about:blank"
53  ["documentURI"]=>
54  string(11) "about:blank"
55  ["characterSet"]=>
56  string(5) "UTF-8"
57  ["charset"]=>
58  string(5) "UTF-8"
59  ["inputEncoding"]=>
60  string(5) "UTF-8"
61  ["doctype"]=>
62  NULL
63  ["documentElement"]=>
64  NULL
65  ["firstElementChild"]=>
66  NULL
67  ["lastElementChild"]=>
68  NULL
69  ["childElementCount"]=>
70  int(0)
71  ["nodeType"]=>
72  int(9)
73  ["nodeName"]=>
74  string(9) "#document"
75  ["baseURI"]=>
76  string(11) "about:blank"
77  ["isConnected"]=>
78  bool(true)
79  ["ownerDocument"]=>
80  NULL
81  ["parentNode"]=>
82  NULL
83  ["parentElement"]=>
84  NULL
85  ["childNodes"]=>
86  string(22) "(object value omitted)"
87  ["firstChild"]=>
88  NULL
89  ["lastChild"]=>
90  NULL
91  ["previousSibling"]=>
92  NULL
93  ["nextSibling"]=>
94  NULL
95  ["nodeValue"]=>
96  NULL
97  ["textContent"]=>
98  NULL
99}
100--- (null, "qname") ---
101<?xml version="1.0" encoding="UTF-8"?>
102<qname/>
103--- ("", "qname") ---
104<?xml version="1.0" encoding="UTF-8"?>
105<qname/>
106--- ("urn:a", "qname") ---
107<?xml version="1.0" encoding="UTF-8"?>
108<qname xmlns="urn:a"/>
109--- With doctype ---
110<?xml version="1.0" encoding="UTF-8"?>
111<!DOCTYPE mydoc>
112
113--- With auto-adopting doctype ---
114<?xml version="1.0" encoding="UTF-8"?>
115<!DOCTYPE mydoc>
116