From 8b07e94f2b95feaceb668d39ddad74f3d65355c5 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Thu, 11 May 2023 10:05:47 +0200 Subject: [PATCH] chore: allow phpunit 9 --- composer.json | 2 +- test/HTML5/Html5Test.php | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 69f5da0..35b4a57 100644 --- a/composer.json +++ b/composer.json @@ -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"} diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index 1887a8d..2f08104 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -93,7 +93,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() @@ -373,7 +378,13 @@ public function testElements() public function testAttributes() { $res = $this->cycle(''); - $this->assertContains('', $res); + + // phpunit 9 + if (method_exists($this, 'assertStringContainsString')) { + $this->assertStringContainsString('', $res); + } else { + $this->assertContains('', $res); + } $res = $this->cycle('
FOO
'); $this->assertRegExp('|
FOO
|', $res); @@ -487,9 +498,12 @@ public function testCDATA() public function testAnchorTargetQueryParam() { $res = $this->cycle('https://domain.com/page.php?foo=bar&target=baz'); - $this->assertContains( - 'https://domain.com/page.php?foo=bar&target=baz', - $res - ); + + // phpunit 9 + if (method_exists($this, 'assertStringContainsString')) { + $this->assertStringContainsString('https://domain.com/page.php?foo=bar&target=baz', $res); + } else { + $this->assertContains('https://domain.com/page.php?foo=bar&target=baz', $res); + } } }