diff options
author | Matt Butcher <[email protected]> | 2014-02-11 09:56:01 -0700 |
---|---|---|
committer | Matt Butcher <[email protected]> | 2014-02-11 09:56:01 -0700 |
commit | 44e8e23626bf619844baf9983e931d2f58606377 (patch) | |
tree | 62625f63a954ab5a3f9bb4184039a68496e3896a /test/HTML5/Serializer/TraverserTest.php | |
parent | 77ad931cd824feb33eebae08cf3a5a47bce1e337 (diff) | |
parent | 3b691837c6d7a0969137048fbda274463d6b1d7c (diff) |
Merge branch 'master' of github.com:Masterminds/html5-php
Diffstat (limited to 'test/HTML5/Serializer/TraverserTest.php')
-rw-r--r-- | test/HTML5/Serializer/TraverserTest.php | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php index 6fa5c1e..5816bfc 100644 --- a/test/HTML5/Serializer/TraverserTest.php +++ b/test/HTML5/Serializer/TraverserTest.php @@ -59,20 +59,33 @@ class TraverserTest extends \HTML5\Tests\TestCase { $this->assertInstanceOf('\HTML5\Serializer\Traverser', $t); } - function testFragment() { - $html = '<span class="bar">foo</span><span></span><div>bar</div>'; - $input = new \HTML5\Parser\StringInputStream($html); - $dom = \HTML5::parseFragment($input); + function testFragment() { + $html = '<span class="bar">foo</span><span></span><div>bar</div>'; + $input = new \HTML5\Parser\StringInputStream($html); + $dom = \HTML5::parseFragment($input); - //fprintf(STDOUT, print_r($dom, TRUE)); + $this->assertInstanceOf('\DOMDocumentFragment', $dom); - $this->assertInstanceOf('\DOMDocumentFragment', $dom); + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, \HTML5::options()); + $t = new Traverser($dom, $stream, $r, \HTML5::options()); + + $out = $t->walk(); + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + function testProcessorInstruction() { + $html = '<?foo bar ?>'; + $input = new \HTML5\Parser\StringInputStream($html); + $dom = \HTML5::parseFragment($input); - $stream = fopen('php://temp', 'w'); - $r = new OutputRules($stream, \HTML5::options()); - $t = new Traverser($dom, $stream, $r, \HTML5::options()); + $this->assertInstanceOf('\DOMDocumentFragment', $dom); - $out = $t->walk(); - $this->assertEquals($html, stream_get_contents($stream, -1, 0)); - } + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, \HTML5::options()); + $t = new Traverser($dom, $stream, $r, \HTML5::options()); + + $out = $t->walk(); + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } } |