diff --git a/ext/bulk_add/test.php b/ext/bulk_add/test.php index 6ffc5fb8..2bf423b6 100644 --- a/ext/bulk_add/test.php +++ b/ext/bulk_add/test.php @@ -10,7 +10,7 @@ class BulkAddTest extends ShimmiePHPUnitTestCase $bae = new BulkAddEvent('asdf'); send_event($bae); - $this->assertContains( + $this->assertStringContainsString( "Error, asdf is not a readable directory", $bae->results, implode("\n", $bae->results) diff --git a/ext/comment/test.php b/ext/comment/test.php index 357e5753..f1853a72 100644 --- a/ext/comment/test.php +++ b/ext/comment/test.php @@ -32,28 +32,28 @@ class CommentListTest extends ShimmiePHPUnitTestCase try { send_event(new CommentPostingEvent($image_id, $user, "Test Comment ASDFASDF")); } catch (CommentPostingException $e) { - $this->assertContains("try and be more original", $e->getMessage()); + $this->assertStringContainsString("try and be more original", $e->getMessage()); } # empty comment try { send_event(new CommentPostingEvent($image_id, $user, "")); } catch (CommentPostingException $e) { - $this->assertContains("Comments need text", $e->getMessage()); + $this->assertStringContainsString("Comments need text", $e->getMessage()); } # whitespace is still empty... try { send_event(new CommentPostingEvent($image_id, $user, " \t\r\n")); } catch (CommentPostingException $e) { - $this->assertContains("Comments need text", $e->getMessage()); + $this->assertStringContainsString("Comments need text", $e->getMessage()); } # repetitive (aka. gzip gives >= 10x improvement) try { send_event(new CommentPostingEvent($image_id, $user, str_repeat("U", 5000))); } catch (CommentPostingException $e) { - $this->assertContains("Comment too repetitive", $e->getMessage()); + $this->assertStringContainsString("Comment too repetitive", $e->getMessage()); } # test UTF8 diff --git a/ext/site_description/test.php b/ext/site_description/test.php index 6cd01aa0..f6cdff93 100644 --- a/ext/site_description/test.php +++ b/ext/site_description/test.php @@ -6,7 +6,7 @@ class SiteDescriptionTest extends ShimmiePHPUnitTestCase global $config, $page; $config->set_string("site_description", "A Shimmie testbed"); $this->get_page("post/list"); - $this->assertContains( + $this->assertStringContainsString( '', $page->get_all_html_headers() ); @@ -17,7 +17,7 @@ class SiteDescriptionTest extends ShimmiePHPUnitTestCase global $config, $page; $config->set_string("site_keywords", "foo,bar,baz"); $this->get_page("post/list"); - $this->assertContains( + $this->assertStringContainsString( '', $page->get_all_html_headers() ); diff --git a/ext/upload/test.php b/ext/upload/test.php index 8b4eb618..5e01e3ec 100644 --- a/ext/upload/test.php +++ b/ext/upload/test.php @@ -22,7 +22,7 @@ class UploadTest extends ShimmiePHPUnitTestCase try { $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot"); } catch (UploadException $e) { - $this->assertContains("already has hash", $e->getMessage()); + $this->assertStringContainsString("already has hash", $e->getMessage()); } } @@ -31,7 +31,7 @@ class UploadTest extends ShimmiePHPUnitTestCase try { $this->post_image("index.php", "test"); } catch (UploadException $e) { - $this->assertContains("Invalid or corrupted file", $e->getMessage()); + $this->assertStringContainsString("Invalid or corrupted file", $e->getMessage()); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 50fef9ec..ff2dd0b3 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -77,7 +77,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase protected function assert_title(string $title) { global $page; - $this->assertContains($title, $page->title); + $this->assertStringContainsString($title, $page->title); } protected function assert_no_title(string $title) @@ -107,7 +107,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase protected function assert_text(string $text, string $section=null) { - $this->assertContains($text, $this->page_to_text($section)); + $this->assertStringContainsString($text, $this->page_to_text($section)); } protected function assert_no_text(string $text, string $section=null) @@ -118,7 +118,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase protected function assert_content(string $content) { global $page; - $this->assertContains($content, $page->data); + $this->assertStringContainsString($content, $page->data); } protected function assert_no_content(string $content)