File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 13
13
#[Small]
14
14
class DocumentCollectionTest extends TestCase {
15
15
16
+ public function testIsInitiallyEmpty (): void {
17
+ $ this ->assertTrue (
18
+ (new DocumentCollection ())->isEmpty ()
19
+ );
20
+ }
21
+
16
22
public function testIteratesOverDocuments (): void {
17
23
18
24
$ documents = [];
@@ -44,6 +50,7 @@ public function testCanAddDocument(): void {
44
50
45
51
$ this ->assertContains ($ document , $ collection );
46
52
$ this ->assertCount (2 , $ collection );
53
+ $ this ->assertFalse ($ collection ->isEmpty ());
47
54
}
48
55
49
56
public function testAssocArrayLoosesKeyCorrectly (): void {
Original file line number Diff line number Diff line change @@ -217,6 +217,32 @@ public function testNoRedundantNamespacesAreCreated(): void {
217
217
);
218
218
}
219
219
220
+ public function testRedundantWhitespaceOnTextNodesGetsTrimmed (): void {
221
+ $ dom = new DOMDocument ();
222
+ $ dom ->preserveWhiteSpace = true ;
223
+ $ dom ->loadXML (
224
+ '<html xmlns="http://www.w3.org/1999/xhtml">
225
+
226
+
227
+ <p />
228
+
229
+
230
+ </html>
231
+ ' );
232
+
233
+ $ expected = implode ("\n" , [
234
+ '<html xmlns="http://www.w3.org/1999/xhtml"> ' ,
235
+ ' <p></p> ' ,
236
+ '</html> ' . "\n"
237
+ ]);
238
+
239
+ $ this ->assertSame (
240
+ $ expected ,
241
+ (new HTMLSerializer ())->noHtml5Doctype ()->serialize ($ dom )
242
+ );
243
+
244
+ }
245
+
220
246
221
247
private function createInputDocument (): Document {
222
248
return Document::fromString (file_get_contents (__DIR__ . '/../_data/serializer/input.xml ' ));
You can’t perform that action at this time.
0 commit comments