summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-03 16:05:39 -0400
committerMatt Farina <[email protected]>2013-05-03 16:05:39 -0400
commit40cf562d10ad605bc7cd113cfeb9329c19a20204 (patch)
tree519ee90b34226230688633fcd5384415b7b2300c /test
parent166265a60a5c0903a72eeca09381369edd1f6341 (diff)
Tests and comments for new lines in the traverser.
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Serializer/TraverserTest.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php
index adc56ea..0226f5e 100644
--- a/test/HTML5/Serializer/TraverserTest.php
+++ b/test/HTML5/Serializer/TraverserTest.php
@@ -37,6 +37,20 @@ class TraverserTest extends \HTML5\Tests\TestCase {
return $method;
}
+ function getTraverser() {
+ $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);
+
+ // We return both the traverser and stream so we can pull from it.
+ return array($t, $stream);
+ }
+
function testConstruct() {
// The traverser needs a place to write the output to. In our case we
@@ -52,4 +66,12 @@ class TraverserTest extends \HTML5\Tests\TestCase {
$this->assertInstanceOf('\HTML5\Serializer\Traverser', $t);
}
+
+ function testNl() {
+ list($t, $s) = $this->getTraverser();
+
+ $m = $this->getProtectedMethod('nl');
+ $m->invoke($t);
+ $this->assertEquals(PHP_EOL, stream_get_contents($s, -1, 0));
+ }
} \ No newline at end of file