Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test enhancement #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/HTML5/Html5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Html5Test extends TestCase
*/
private $html5;

public function setUp()
protected function setUp()
{
$this->html5 = $this->getInstance();
}
Expand Down Expand Up @@ -226,15 +226,15 @@ public function testConfig()
{
$html5 = $this->getInstance();
$options = $html5->getOptions();
$this->assertEquals(false, $options['encode_entities']);
$this->assertFalse($options['encode_entities']);

$html5 = $this->getInstance(array(
'foo' => 'bar',
'encode_entities' => true,
));
$options = $html5->getOptions();
$this->assertEquals('bar', $options['foo']);
$this->assertEquals(true, $options['encode_entities']);
$this->assertTrue($options['encode_entities']);

// Need to reset to original so future tests pass as expected.
// $this->getInstance()->setOption('encode_entities', false);
Expand Down
12 changes: 6 additions & 6 deletions test/HTML5/Parser/DOMTreeBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testBareAmpersand()
{
$html = "<!doctype html>
<html>
<body>
<body>
<img src='a&b' />
<img src='a&=' />
<img src='a&=c' />
Expand All @@ -74,7 +74,7 @@ public function testBareAmpersand()
$this->assertEmpty($this->errors);
$this->assertXmlStringEqualsXmlString('
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<img src="a&amp;b"/>
<img src="a&amp;="/>
<img src="a&amp;=c"/>
Expand All @@ -97,7 +97,7 @@ public function testBareAmpersandNotAllowedInAttributes()
$this->assertCount(2, $this->errors);
$this->assertXmlStringEqualsXmlString('
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<img src="a&amp;"/>
<img src="a&amp;+"/>
</body>
Expand All @@ -108,7 +108,7 @@ public function testBareAmpersandNotAllowedInBody()
{
$html = '<!doctype html>
<html>
<body>
<body>
a&b
a&=
a&=c
Expand All @@ -122,7 +122,7 @@ public function testBareAmpersandNotAllowedInBody()
$this->assertCount(5, $this->errors);
$this->assertXmlStringEqualsXmlString('
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
a&amp;b
a&amp;=
a&amp;=c
Expand Down Expand Up @@ -467,7 +467,7 @@ public function testParseErrors()
// We're JUST testing that we can access errors. Actual testing of
// error messages happen in the Tokenizer's tests.
$this->assertGreaterThan(0, count($this->errors));
$this->assertTrue(is_string($this->errors[0]));
$this->assertInternalType('string', $this->errors[0]);
}

public function testProcessingInstruction()
Expand Down
6 changes: 3 additions & 3 deletions test/HTML5/Serializer/OutputRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OutputRulesTest extends \Masterminds\HTML5\Tests\TestCase
*/
protected $html5;

public function setUp()
protected function setUp()
{
$this->html5 = $this->getInstance();
}
Expand Down Expand Up @@ -645,8 +645,8 @@ public function testHandlingInvalidRawContent()

$contents = $this->html5->saveHTML($dom);

$this->assertTrue(false !== strpos($contents, '<script id="template" type="x-tmpl-mustache">
$this->assertContains('<script id="template" type="x-tmpl-mustache">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<h1>Hello!</h1>
<p>Bar</p></script>'));
<p>Bar</p></script>', $contents);
}
}
4 changes: 2 additions & 2 deletions test/HTML5/Serializer/TraverserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TraverserTest extends \Masterminds\HTML5\Tests\TestCase
</body>
</html>';

public function setUp()
protected function setUp()
{
$this->html5 = $this->getInstance();
}
Expand All @@ -45,7 +45,7 @@ public function getTraverser()
$stream = fopen('php://temp', 'w');

$dom = $this->html5->loadHTML($this->markup);
$t = new Traverser($dom, $stream, $html5->getOptions());
$t = new Traverser($dom, $stream, $this->html5->getOptions());

// We return both the traverser and stream so we can pull from it.
return array(
Expand Down