From 3b5f44cb1faadc7c44276be4302baa4901996c00 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 26 Jun 2013 16:37:48 -0400 Subject: Removed extra method for preparing html --- test/HTML5/Serializer/SerializerTest.php | 41 +++++++++++++------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'test') 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('' . $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 '' . $markup . ''; - } - public function testSaveHTML() { $html = 'test'; @@ -89,33 +77,33 @@ class SerializerTest extends \HTML5\Tests\TestCase { public function testElements() { // Should have content. - $res = $this->cycle($this->prepareHtml('
FOO
')); + $res = $this->cycle('
FOO
'); $this->assertRegExp('|
FOO
|', $res); // Should be empty - $res = $this->cycle($this->prepareHtml('')); + $res = $this->cycle(''); $this->assertRegExp('||', $res); // Should have no closing tag. - $res = $this->cycle($this->prepareHtml('
')); + $res = $this->cycle('
'); $this->assertRegExp('|
|', $res); } public function testAttributes() { - $res = $this->cycle($this->prepareHtml('
FOO
')); + $res = $this->cycle('
FOO
'); $this->assertRegExp('|
FOO
|', $res); // XXX: Note that spec does NOT require attrs in the same order. - $res = $this->cycle($this->prepareHtml('
FOO
')); + $res = $this->cycle('
FOO
'); $this->assertRegExp('|
FOO
|', $res); - $res = $this->cycle($this->prepareHtml('
FOO
')); + $res = $this->cycle('
FOO
'); $this->assertRegExp('|
FOO
|', $res); } public function testPCData() { - $res = $this->cycle($this->prepareHtml('This is a test.')); + $res = $this->cycle('This is a test.'); $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('')); + $res = $this->cycle(''); $this->assertRegExp('|2 < 1|', $res); - $res = $this->cycle($this->prepareHtml('')); + $res = $this->cycle(''); $this->assertRegExp('|div>div>div|', $res); } public function testEntities() { - $res = $this->cycle($this->prepareHtml('Apples & bananas.')); + $res = $this->cycle('Apples & bananas.'); + $this->assertRegExp('|Apples & bananas.|', $res); + + $res = $this->cycleFragment('Apples & bananas.'); $this->assertRegExp('|Apples & bananas.|', $res); } public function testComment() { - $res = $this->cycle($this->prepareHtml('ab')); + $res = $this->cycle('ab'); $this->assertRegExp('||', $res); $res = $this->cycleFragment('ab'); @@ -152,7 +143,7 @@ class SerializerTest extends \HTML5\Tests\TestCase { } public function testCDATA() { - $res = $this->cycle($this->prepareHtml('a a test. ]]>b')); + $res = $this->cycle('a a test. ]]>b'); $this->assertRegExp('| a test\. \]\]>|', $res); $res = $this->cycleFragment('a a test. ]]>b'); -- cgit v1.2.3