Skip to content

Commit 8b07e94

Browse files
committed
chore: allow phpunit 9
1 parent f47dcf3 commit 8b07e94

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"php" : ">=5.3.0"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8"
27+
"phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9"
2828
},
2929
"autoload": {
3030
"psr-4": {"Masterminds\\": "src"}

test/HTML5/Html5Test.php

+20-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ public function testEncodingUtf8()
9393
$this->assertEmpty($this->html5->getErrors());
9494
$this->assertFalse($this->html5->hasErrors());
9595

96-
$this->assertContains('Žťčýů', $dom->saveHTML());
96+
// phpunit 9
97+
if (method_exists($this, 'assertStringContainsString')) {
98+
$this->assertStringContainsString('Žťčýů', $dom->saveHTML());
99+
} else {
100+
$this->assertContains('Žťčýů', $dom->saveHTML());
101+
}
97102
}
98103

99104
public function testEncodingWindows1252()
@@ -373,7 +378,13 @@ public function testElements()
373378
public function testAttributes()
374379
{
375380
$res = $this->cycle('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>');
376-
$this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
381+
382+
// phpunit 9
383+
if (method_exists($this, 'assertStringContainsString')) {
384+
$this->assertStringContainsString('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
385+
} else {
386+
$this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
387+
}
377388

378389
$res = $this->cycle('<div attr="val">FOO</div>');
379390
$this->assertRegExp('|<div attr="val">FOO</div>|', $res);
@@ -487,9 +498,12 @@ public function testCDATA()
487498
public function testAnchorTargetQueryParam()
488499
{
489500
$res = $this->cycle('<a href="https://domain.com/page.php?foo=bar&target=baz">https://domain.com/page.php?foo=bar&target=baz</a>');
490-
$this->assertContains(
491-
'<a href="https://domain.com/page.php?foo=bar&amp;target=baz">https://domain.com/page.php?foo=bar&amp;target=baz</a>',
492-
$res
493-
);
501+
502+
// phpunit 9
503+
if (method_exists($this, 'assertStringContainsString')) {
504+
$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);
505+
} else {
506+
$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);
507+
}
494508
}
495509
}

0 commit comments

Comments
 (0)