We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5797af commit fb5cd82Copy full SHA for fb5cd82
src/Drivers/HtmlDriver.php
@@ -15,6 +15,10 @@ public function serialize($data): string
15
throw new CantBeSerialized('Only strings can be serialized to html');
16
}
17
18
+ if ('' === $data) {
19
+ return "\n";
20
+ }
21
+
22
$domDocument = new DOMDocument('1.0');
23
$domDocument->preserveWhiteSpace = false;
24
$domDocument->formatOutput = true;
tests/Unit/Drivers/HtmlDriverTest.php
@@ -71,4 +71,12 @@ public function it_can_only_serialize_strings()
71
72
$driver->serialize(['foo' => 'bar']);
73
74
75
+ /** @test */
76
+ public function it_can_serialize_an_empty_string()
77
+ {
78
+ $driver = new HtmlDriver();
79
80
+ $this->assertEquals("\n", $driver->serialize(''));
81
82
0 commit comments