From 27965d0287c31516be1170cf26b39e07dff14676 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 25 Oct 2022 06:53:07 +0200 Subject: [PATCH] make tests compatible with newer phpunit --- tst/ControllerTest.php | 2 +- tst/I18nTest.php | 2 +- tst/JsonApiTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tst/ControllerTest.php b/tst/ControllerTest.php index 5e3b924b..6656cf66 100644 --- a/tst/ControllerTest.php +++ b/tst/ControllerTest.php @@ -66,7 +66,7 @@ class ControllerTest extends TestCase $content, 'doesn\'t output shortener button' ); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '# href="https://' . preg_quote($_SERVER['HTTP_HOST']) . '/">switching to HTTPS#', $content, 'outputs configured https URL correctly' diff --git a/tst/I18nTest.php b/tst/I18nTest.php index ac4cfcb0..98eaa32f 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -189,7 +189,7 @@ class I18nTest extends TestCase foreach (array_keys($languages) as $language) { // most languages don't translate the data size units, ignore those if ($messageId !== 'B' && strlen($messageId) !== 3 && strpos($messageId, 'B', 2) !== 2) { - $this->assertContains( + $this->assertStringContains( $messageId, $languages[$language], "message ID '$messageId' exists in translation file $language.json" diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php index a9f73b38..328d66be 100644 --- a/tst/JsonApiTest.php +++ b/tst/JsonApiTest.php @@ -287,7 +287,7 @@ class JsonApiTest extends TestCase new Controller; $content = ob_get_contents(); ob_end_clean(); - $this->assertContains('id="pasteurl" href="https://example.com/1"', $content, 'outputs shortened URL correctly'); + $this->assertStringContains('id="pasteurl" href="https://example.com/1"', $content, 'outputs shortened URL correctly'); } /** @@ -301,6 +301,6 @@ class JsonApiTest extends TestCase new Controller; $content = ob_get_contents(); ob_end_clean(); - $this->assertContains('Error calling YOURLS.', $content, 'outputs error correctly'); + $this->assertStringContains('Error calling YOURLS.', $content, 'outputs error correctly'); } }