diff options
author | Matt Farina <[email protected]> | 2013-05-03 13:00:18 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-05-03 13:00:18 -0400 |
commit | 166265a60a5c0903a72eeca09381369edd1f6341 (patch) | |
tree | 8c890c164d7f3be085fc660a3bde2cd2e0866e9e /test | |
parent | ec36cb8d909b4f8d36c9fd479265c053b3b813f1 (diff) |
Added constructor test to the traverser.
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/Serializer/TraverserTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php index 7162c6e..adc56ea 100644 --- a/test/HTML5/Serializer/TraverserTest.php +++ b/test/HTML5/Serializer/TraverserTest.php @@ -8,6 +8,19 @@ require_once __DIR__ . '/../TestCase.php'; class TraverserTest extends \HTML5\Tests\TestCase { + // Dummy markup to parse then try to traverse. Note, not using any html5 + // so we can use the old parser until ours is complete. + protected $markup = '<!doctype html> + <html lang="en"> + <head> + <meta charset="utf-8"> + <title>Test</title> + </head> + <body> + <p>This is a test.</p> + </body> + </html>'; + /** * Using reflection we make a protected method accessible for testing. * @@ -23,4 +36,20 @@ class TraverserTest extends \HTML5\Tests\TestCase { $method->setAccessible(true); return $method; } + + function testConstruct() { + + // The traverser needs a place to write the output to. In our case we + // use a stream in temp space. + $stream = fopen('php://temp', 'w'); + + // Using the existing parser (libxml). + // @todo switch to the html5 parser. + $dom = new \DOMDocument(); + $dom->loadHTML($this->markup); + + $t = new Traverser($dom, $stream); + + $this->assertInstanceOf('\HTML5\Serializer\Traverser', $t); + } }
\ No newline at end of file |