Skip to content

Commit

Permalink
chore: allow phpunit 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris8934 committed May 11, 2023
1 parent f47dcf3 commit 4c3dc08
Show file tree
Hide file tree
Showing 2 changed files with 27 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
32 changes: 26 additions & 6 deletions test/HTML5/Html5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ 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 @@ -373,7 +380,15 @@ 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 @@ -487,9 +502,14 @@ 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 4c3dc08

Please sign in to comment.