From 166265a60a5c0903a72eeca09381369edd1f6341 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Fri, 3 May 2013 13:00:18 -0400 Subject: Added constructor test to the traverser. --- test/HTML5/Serializer/TraverserTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') 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 = ' + + + + Test + + +

This is a test.

+ + '; + /** * 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 -- cgit v1.2.3