@@ -16,10 +16,23 @@ class DocumentBaselineTest extends TestCase
16
16
/**
17
17
* @test
18
18
*/
19
- public function document_can_modify_doctype_properties (): void
19
+ public function document_can_remove_optional_declaration_props (): void
20
20
{
21
21
$ this ->assertSame (
22
- '<?xml version = "1.1" encoding = "UTF-16" standalone = "no" ?> ' . "\n" .
22
+ '<?xml version="1.0" ?> ' . "\n" . '<root></root> ' ,
23
+ (string ) Document::create ('root ' )
24
+ ->removeEncoding ()
25
+ ->removeStandalone ()
26
+ );
27
+ }
28
+
29
+ /**
30
+ * @test
31
+ */
32
+ public function document_can_modify_declaration_properties (): void
33
+ {
34
+ $ this ->assertSame (
35
+ '<?xml version="1.1" encoding="UTF-16" standalone="no" ?> ' . "\n" .
23
36
'<root></root> ' ,
24
37
(string ) Document::create ('root ' )
25
38
->setVersion (1.1 )
@@ -28,7 +41,7 @@ public function document_can_modify_doctype_properties(): void
28
41
);
29
42
30
43
$ this ->assertSame (
31
- '<?xml version = "1.1" encoding = "UTF-16" standalone = "no" ?> ' . "\n" .
44
+ '<?xml version= "1.1" encoding= "UTF-16" standalone= "no" ?> ' . "\n" .
32
45
'<root></root> ' ,
33
46
(string ) Document::create ('root ' )
34
47
->setVersion ('1.1 ' )
@@ -37,7 +50,7 @@ public function document_can_modify_doctype_properties(): void
37
50
);
38
51
39
52
$ this ->assertSame (
40
- '<?xml version = "1.0" encoding = "UTF-16" standalone = "no" ?> ' . "\n" .
53
+ '<?xml version= "1.0" encoding= "UTF-16" standalone= "no" ?> ' . "\n" .
41
54
'<root></root> ' ,
42
55
(string ) Document::create ('root ' )
43
56
->setVersion (1 )
@@ -51,9 +64,9 @@ public function document_can_modify_doctype_properties(): void
51
64
*/
52
65
public function document_is_stringable (): void
53
66
{
54
- $ this ->assertEquals (
55
- ( string ) Document:: create ( ' root ' )-> props ( ' id 6 ' , ' property hello ' ) ,
56
- ' <?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' . "\n" . ' <root id="6" property=" hello"></root> '
67
+ $ this ->assertSame (
68
+ ' <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' . "\n" . ' <root id="6" property=" hello"></root> ' ,
69
+ ( string ) Document:: create ( ' root ' )-> props ( ' id 6 ' , ' property hello ' )
57
70
);
58
71
}
59
72
@@ -62,17 +75,17 @@ public function document_is_stringable(): void
62
75
*/
63
76
public function document_can_have_comment (): void
64
77
{
65
- $ this ->assertEquals (
78
+ $ this ->assertSame (
79
+ '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' .
80
+ "\n" .
81
+ '<root> ' . "\n" .
82
+ '<!-- comment --> ' . "\n" .
83
+ '<tag /></root> ' ,
66
84
Document::create (
67
85
'root ' ,
68
86
Comment::create ('comment ' ),
69
87
Element::create ('tag ' )->omitEndTag ()
70
- )->build (),
71
- '<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' .
72
- "\n" .
73
- '<root> ' . "\n" .
74
- '<!-- comment --> ' . "\n" .
75
- '<tag /></root> '
88
+ )->build ()
76
89
);
77
90
}
78
91
@@ -81,9 +94,9 @@ public function document_can_have_comment(): void
81
94
*/
82
95
public function document_can_have_properties (): void
83
96
{
84
- $ this ->assertEquals (
85
- Document:: create ( ' root ' )-> props ( ' id 6 ' , ' property hello ' )-> build () ,
86
- ' <?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' . "\n" . ' <root id="6" property=" hello"></root> '
97
+ $ this ->assertSame (
98
+ ' <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' . "\n" . ' <root id="6" property=" hello"></root> ' ,
99
+ Document:: create ( ' root ' )-> props ( ' id 6 ' , ' property hello ' )-> build ()
87
100
);
88
101
}
89
102
@@ -92,14 +105,14 @@ public function document_can_have_properties(): void
92
105
*/
93
106
public function document_can_use_shorthand (): void
94
107
{
95
- $ this ->assertEquals (
108
+ $ this ->assertSame (
109
+ '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' ."\n" .'<root><child><grandchild></grandchild><![CDATA[String]]></child></root> ' ,
96
110
Document::root (
97
111
Element::child (
98
112
Element::grandchild (),
99
113
Cdata::create ('String ' )
100
114
)
101
- )->build (),
102
- '<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' ."\n" .'<root><child><grandchild></grandchild><![CDATA[String]]></child></root> '
115
+ )->build ()
103
116
);
104
117
}
105
118
@@ -108,14 +121,15 @@ public function document_can_use_shorthand(): void
108
121
*/
109
122
public function document_can_accept_content (): void
110
123
{
111
- $ this ->assertEquals (
112
- Document::create ('root ' ,
124
+ $ this ->assertSame (
125
+ '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' ."\n" .'<root><child><grandchild></grandchild><![CDATA[String]]></child></root> ' ,
126
+ Document::create (
127
+ 'root ' ,
113
128
Element::create ('child ' ,
114
129
Element::create ('grandchild ' ),
115
130
Cdata::create ('String ' )
116
131
)
117
- )->build (),
118
- '<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' ."\n" .'<root><child><grandchild></grandchild><![CDATA[String]]></child></root> '
132
+ )->build ()
119
133
);
120
134
}
121
135
@@ -124,17 +138,9 @@ public function document_can_accept_content(): void
124
138
*/
125
139
public function document_can_initialized_statically (): void
126
140
{
127
- $ this ->assertEquals (
128
- Document:: create ( ' tag ' )-> build () ,
129
- ' <?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?> ' . "\n" . ' < tag></tag> '
141
+ $ this ->assertSame (
142
+ ' <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> ' . "\n" . ' <tag></tag> ' ,
143
+ Document:: create ( ' tag ' )-> build ()
130
144
);
131
145
}
132
-
133
- /**
134
- *@test
135
- */
136
- public function document_exists (): void
137
- {
138
- $ this ->assertTrue (class_exists (Document::class));
139
- }
140
146
}
0 commit comments