diff options
author | Asmir Mustafic <[email protected]> | 2014-09-30 23:26:53 +0200 |
---|---|---|
committer | Asmir Mustafic <[email protected]> | 2014-09-30 23:26:53 +0200 |
commit | 75fe1de1a15c5f83da53059efaef7c67902c9043 (patch) | |
tree | 462e82f24b7891aff0f24eba0aa7d3bb95f6877f /test/HTML5/Serializer | |
parent | 496b8033abfb9d6de6005b3f6226e1f046899395 (diff) |
Handling empty documents
Diffstat (limited to 'test/HTML5/Serializer')
-rw-r--r-- | test/HTML5/Serializer/OutputRulesTest.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index e89d723..aa2e0c5 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -76,6 +76,19 @@ class OutputRulesTest extends \Masterminds\HTML5\Tests\TestCase $this->assertEquals($expected, stream_get_contents($stream, - 1, 0)); } + public function testEmptyDocument() + { + $dom = $this->html5->loadHTML(''); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + + $r->document($dom); + $expected = '<!DOCTYPE html>' . PHP_EOL; + $this->assertEquals($expected, stream_get_contents($stream, - 1, 0)); + } + public function testDoctype() { $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>foo</body></html>'); |