Skip to content

Commit

Permalink
Merge pull request #235 from Chris53897/feat/phpunit-9
Browse files Browse the repository at this point in the history
chore: allow phpunit 9
  • Loading branch information
goetas committed Mar 31, 2024
2 parents 5bd1838 + 8b07e94 commit f5ac2c0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"php" : ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8"
"phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9"
},
"autoload": {
"psr-4": {"Masterminds\\": "src"}
Expand Down
26 changes: 20 additions & 6 deletions test/HTML5/Html5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ public function testEncodingUtf8()
$this->assertEmpty($this->html5->getErrors());
$this->assertFalse($this->html5->hasErrors());

$this->assertContains('Žťčýů', $dom->saveHTML());
// phpunit 9
if (method_exists($this, 'assertStringContainsString')) {
$this->assertStringContainsString('Žťčýů', $dom->saveHTML());
} else {
$this->assertContains('Žťčýů', $dom->saveHTML());
}
}

public function testEncodingWindows1252()
Expand Down Expand Up @@ -427,7 +432,13 @@ public function testElements()
public function testAttributes()
{
$res = $this->cycle('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>');
$this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);

// phpunit 9
if (method_exists($this, 'assertStringContainsString')) {
$this->assertStringContainsString('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
} else {
$this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
}

$res = $this->cycle('<div attr="val">FOO</div>');
$this->assertRegExp('|<div attr="val">FOO</div>|', $res);
Expand Down Expand Up @@ -541,9 +552,12 @@ public function testCDATA()
public function testAnchorTargetQueryParam()
{
$res = $this->cycle('<a href="https://domain.com/page.php?foo=bar&target=baz">https://domain.com/page.php?foo=bar&target=baz</a>');
$this->assertContains(
'<a href="https://domain.com/page.php?foo=bar&amp;target=baz">https://domain.com/page.php?foo=bar&amp;target=baz</a>',
$res
);

// phpunit 9
if (method_exists($this, 'assertStringContainsString')) {
$this->assertStringContainsString('<a href="https://domain.com/page.php?foo=bar&amp;target=baz">https://domain.com/page.php?foo=bar&amp;target=baz</a>', $res);
} else {
$this->assertContains('<a href="https://domain.com/page.php?foo=bar&amp;target=baz">https://domain.com/page.php?foo=bar&amp;target=baz</a>', $res);
}
}
}

0 comments on commit f5ac2c0

Please sign in to comment.