summaryrefslogtreecommitdiff
path: root/test/HTML5/Serializer/SerializerTest.php
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-27 17:38:02 -0400
committerMatt Farina <[email protected]>2013-05-27 17:38:02 -0400
commit0e7cd49d390160603563c17c76dea82eba1824b9 (patch)
treebeae415abb00ddcaa025d5b93aff793c5dfd8b07 /test/HTML5/Serializer/SerializerTest.php
parent3f7e489e0eab9b34d6c707d13726eaa195bef2eb (diff)
Seperated the Traverser from the Output generation.
The Traverser now simply walks through a document. The OutputRules convert the nodes into output html. The rules is a configurable options. By default OutputRules will generate html close to the html5 that was parsed. Alternate rule implementation (e.g., minify rules, pretty spacing rules) can be set as the default or on an individual case.
Diffstat (limited to 'test/HTML5/Serializer/SerializerTest.php')
-rw-r--r--test/HTML5/Serializer/SerializerTest.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/HTML5/Serializer/SerializerTest.php b/test/HTML5/Serializer/SerializerTest.php
index 977f7dd..4a28c54 100644
--- a/test/HTML5/Serializer/SerializerTest.php
+++ b/test/HTML5/Serializer/SerializerTest.php
@@ -20,7 +20,8 @@ class SerializerTest extends \HTML5\Tests\TestCase {
*/
protected function cycle($html) {
$dom = \HTML5::loadHTML($html);
- $ser = new Serializer($dom);
+ $options = \HTML5::options();
+ $ser = new Serializer($dom, $options);
$out = $ser->saveHTML();
return $out;
@@ -44,7 +45,7 @@ class SerializerTest extends \HTML5\Tests\TestCase {
$dom = \HTML5::loadHTML($html);
$this->assertTrue($dom instanceof \DOMDocument, "Canary");
- $ser = new Serializer($dom, FALSE);
+ $ser = new Serializer($dom, \HTML5::options());
$out = $ser->saveHTML();
$this->assertTrue(count($out) >= count($html), 'Byte counts');
@@ -59,7 +60,7 @@ class SerializerTest extends \HTML5\Tests\TestCase {
$dom = \HTML5::loadHTML($html);
$this->assertTrue($dom instanceof \DOMDocument, "Canary");
- $ser = new Serializer($dom, FALSE);
+ $ser = new Serializer($dom, \HTML5::options());
$out = fopen("php://temp", "w");
$ser->save($out);
@@ -99,10 +100,10 @@ class SerializerTest extends \HTML5\Tests\TestCase {
$res = $this->cycle($this->prepareHtml('<a>This is a test.</a>'));
$this->assertRegExp('|This is a test.|', $res);
- $res = $this->cycle('This
+ $res = $this->cycle($this->prepareHtml('This
is
a
- test.');
+ test.'));
// Check that newlines are there, but don't count spaces.
$this->assertRegExp('|This\n\s*is\n\s*a\n\s*test.|', $res);