summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Serializer/TraverserTest.php29
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