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 (32) {
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  ["body"]=>
72  NULL
73  ["head"]=>
74  NULL
75  ["title"]=>
76  string(0) ""
77  ["nodeType"]=>
78  int(9)
79  ["nodeName"]=>
80  string(9) "#document"
81  ["baseURI"]=>
82  string(11) "about:blank"
83  ["isConnected"]=>
84  bool(true)
85  ["ownerDocument"]=>
86  NULL
87  ["parentNode"]=>
88  NULL
89  ["parentElement"]=>
90  NULL
91  ["childNodes"]=>
92  string(22) "(object value omitted)"
93  ["firstChild"]=>
94  NULL
95  ["lastChild"]=>
96  NULL
97  ["previousSibling"]=>
98  NULL
99  ["nextSibling"]=>
100  NULL
101  ["nodeValue"]=>
102  NULL
103  ["textContent"]=>
104  NULL
105}
106--- (null, "qname") ---
107<?xml version="1.0" encoding="UTF-8"?>
108<qname/>
109--- ("", "qname") ---
110<?xml version="1.0" encoding="UTF-8"?>
111<qname/>
112--- ("urn:a", "qname") ---
113<?xml version="1.0" encoding="UTF-8"?>
114<qname xmlns="urn:a"/>
115--- With doctype ---
116<?xml version="1.0" encoding="UTF-8"?>
117<!DOCTYPE mydoc>
118
119--- With auto-adopting doctype ---
120<?xml version="1.0" encoding="UTF-8"?>
121<!DOCTYPE mydoc>
122