diff options
author | Matt Farina <[email protected]> | 2013-06-26 16:37:48 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-06-26 16:37:48 -0400 |
commit | 3b5f44cb1faadc7c44276be4302baa4901996c00 (patch) | |
tree | a964bcdf480aafefe344f08d7349df0e20e250cb /test | |
parent | 794331c4383121c00d883baa51f4e1fc110e80bc (diff) |
Removed extra method for preparing html
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/Serializer/SerializerTest.php | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/test/HTML5/Serializer/SerializerTest.php b/test/HTML5/Serializer/SerializerTest.php index 549eb98..bc4e443 100644 --- a/test/HTML5/Serializer/SerializerTest.php +++ b/test/HTML5/Serializer/SerializerTest.php @@ -19,7 +19,7 @@ class SerializerTest extends \HTML5\Tests\TestCase { * Parse and serialize a string. */ protected function cycle($html) { - $dom = \HTML5::loadHTML($html); + $dom = \HTML5::loadHTML('<!DOCTYPE html><html><body>' . $html . '</body></html>'); $options = \HTML5::options(); $ser = new Serializer($dom, $options); $out = $ser->saveHTML(); @@ -36,18 +36,6 @@ class SerializerTest extends \HTML5\Tests\TestCase { return $out; } - /** - * Wrap a html5 fragment in a html5 document to run through the parser. - * - * @param string $markup - * - * @return string - * html5 fragment wrapped in a document. - */ - protected function prepareHtml($markup) { - return '<!DOCTYPE html><html><body>' . $markup . '</body></html>'; - } - public function testSaveHTML() { $html = '<!DOCTYPE html><html><body>test</body></html>'; @@ -89,33 +77,33 @@ class SerializerTest extends \HTML5\Tests\TestCase { public function testElements() { // Should have content. - $res = $this->cycle($this->prepareHtml('<div>FOO</div>')); + $res = $this->cycle('<div>FOO</div>'); $this->assertRegExp('|<div>FOO</div>|', $res); // Should be empty - $res = $this->cycle($this->prepareHtml('<span></span>')); + $res = $this->cycle('<span></span>'); $this->assertRegExp('|<span></span>|', $res); // Should have no closing tag. - $res = $this->cycle($this->prepareHtml('<hr>')); + $res = $this->cycle('<hr>'); $this->assertRegExp('|<hr></body>|', $res); } public function testAttributes() { - $res = $this->cycle($this->prepareHtml('<div attr="val">FOO</div>')); + $res = $this->cycle('<div attr="val">FOO</div>'); $this->assertRegExp('|<div attr="val">FOO</div>|', $res); // XXX: Note that spec does NOT require attrs in the same order. - $res = $this->cycle($this->prepareHtml('<div attr="val" class="even">FOO</div>')); + $res = $this->cycle('<div attr="val" class="even">FOO</div>'); $this->assertRegExp('|<div attr="val" class="even">FOO</div>|', $res); - $res = $this->cycle($this->prepareHtml('<div xmlns:foo="http://example.com">FOO</div>')); + $res = $this->cycle('<div xmlns:foo="http://example.com">FOO</div>'); $this->assertRegExp('|<div xmlns:foo="http://example.com">FOO</div>|', $res); } public function testPCData() { - $res = $this->cycle($this->prepareHtml('<a>This is a test.</a>')); + $res = $this->cycle('<a>This is a test.</a>'); $this->assertRegExp('|This is a test.|', $res); $res = $this->cycle($this->prepareHtml('This @@ -131,20 +119,23 @@ class SerializerTest extends \HTML5\Tests\TestCase { } public function testUnescaped() { - $res = $this->cycle($this->prepareHtml('<script>2 < 1</script>')); + $res = $this->cycle('<script>2 < 1</script>'); $this->assertRegExp('|2 < 1|', $res); - $res = $this->cycle($this->prepareHtml('<style>div>div>div</style>')); + $res = $this->cycle('<style>div>div>div</style>'); $this->assertRegExp('|div>div>div|', $res); } public function testEntities() { - $res = $this->cycle($this->prepareHtml('<a>Apples & bananas.</a>')); + $res = $this->cycle('<a>Apples & bananas.</a>'); + $this->assertRegExp('|Apples & bananas.|', $res); + + $res = $this->cycleFragment('<a>Apples & bananas.</a>'); $this->assertRegExp('|Apples & bananas.|', $res); } public function testComment() { - $res = $this->cycle($this->prepareHtml('a<!-- This is a test. -->b')); + $res = $this->cycle('a<!-- This is a test. -->b'); $this->assertRegExp('|<!-- This is a test. -->|', $res); $res = $this->cycleFragment('a<!-- This is a test. -->b'); @@ -152,7 +143,7 @@ class SerializerTest extends \HTML5\Tests\TestCase { } public function testCDATA() { - $res = $this->cycle($this->prepareHtml('a<![CDATA[ This <is> a test. ]]>b')); + $res = $this->cycle('a<![CDATA[ This <is> a test. ]]>b'); $this->assertRegExp('|<!\[CDATA\[ This <is> a test\. \]\]>|', $res); $res = $this->cycleFragment('a<![CDATA[ This <is> a test. ]]>b'); |