updates for phpunit 8

This commit is contained in:
Shish 2019-11-21 17:16:11 +00:00
parent 4026181219
commit 1e4f08e9e9
5 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@ class BulkAddTest extends ShimmiePHPUnitTestCase
$bae = new BulkAddEvent('asdf'); $bae = new BulkAddEvent('asdf');
send_event($bae); send_event($bae);
$this->assertContains( $this->assertStringContainsString(
"Error, asdf is not a readable directory", "Error, asdf is not a readable directory",
$bae->results, $bae->results,
implode("\n", $bae->results) implode("\n", $bae->results)

View File

@ -32,28 +32,28 @@ class CommentListTest extends ShimmiePHPUnitTestCase
try { try {
send_event(new CommentPostingEvent($image_id, $user, "Test Comment ASDFASDF")); send_event(new CommentPostingEvent($image_id, $user, "Test Comment ASDFASDF"));
} catch (CommentPostingException $e) { } catch (CommentPostingException $e) {
$this->assertContains("try and be more original", $e->getMessage()); $this->assertStringContainsString("try and be more original", $e->getMessage());
} }
# empty comment # empty comment
try { try {
send_event(new CommentPostingEvent($image_id, $user, "")); send_event(new CommentPostingEvent($image_id, $user, ""));
} catch (CommentPostingException $e) { } catch (CommentPostingException $e) {
$this->assertContains("Comments need text", $e->getMessage()); $this->assertStringContainsString("Comments need text", $e->getMessage());
} }
# whitespace is still empty... # whitespace is still empty...
try { try {
send_event(new CommentPostingEvent($image_id, $user, " \t\r\n")); send_event(new CommentPostingEvent($image_id, $user, " \t\r\n"));
} catch (CommentPostingException $e) { } catch (CommentPostingException $e) {
$this->assertContains("Comments need text", $e->getMessage()); $this->assertStringContainsString("Comments need text", $e->getMessage());
} }
# repetitive (aka. gzip gives >= 10x improvement) # repetitive (aka. gzip gives >= 10x improvement)
try { try {
send_event(new CommentPostingEvent($image_id, $user, str_repeat("U", 5000))); send_event(new CommentPostingEvent($image_id, $user, str_repeat("U", 5000)));
} catch (CommentPostingException $e) { } catch (CommentPostingException $e) {
$this->assertContains("Comment too repetitive", $e->getMessage()); $this->assertStringContainsString("Comment too repetitive", $e->getMessage());
} }
# test UTF8 # test UTF8

View File

@ -6,7 +6,7 @@ class SiteDescriptionTest extends ShimmiePHPUnitTestCase
global $config, $page; global $config, $page;
$config->set_string("site_description", "A Shimmie testbed"); $config->set_string("site_description", "A Shimmie testbed");
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertContains( $this->assertStringContainsString(
'<meta name="description" content="A Shimmie testbed">', '<meta name="description" content="A Shimmie testbed">',
$page->get_all_html_headers() $page->get_all_html_headers()
); );
@ -17,7 +17,7 @@ class SiteDescriptionTest extends ShimmiePHPUnitTestCase
global $config, $page; global $config, $page;
$config->set_string("site_keywords", "foo,bar,baz"); $config->set_string("site_keywords", "foo,bar,baz");
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertContains( $this->assertStringContainsString(
'<meta name="keywords" content="foo,bar,baz">', '<meta name="keywords" content="foo,bar,baz">',
$page->get_all_html_headers() $page->get_all_html_headers()
); );

View File

@ -22,7 +22,7 @@ class UploadTest extends ShimmiePHPUnitTestCase
try { try {
$this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot"); $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
} catch (UploadException $e) { } 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 { try {
$this->post_image("index.php", "test"); $this->post_image("index.php", "test");
} catch (UploadException $e) { } catch (UploadException $e) {
$this->assertContains("Invalid or corrupted file", $e->getMessage()); $this->assertStringContainsString("Invalid or corrupted file", $e->getMessage());
} }
} }

View File

@ -77,7 +77,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase
protected function assert_title(string $title) protected function assert_title(string $title)
{ {
global $page; global $page;
$this->assertContains($title, $page->title); $this->assertStringContainsString($title, $page->title);
} }
protected function assert_no_title(string $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) 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) 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) protected function assert_content(string $content)
{ {
global $page; global $page;
$this->assertContains($content, $page->data); $this->assertStringContainsString($content, $page->data);
} }
protected function assert_no_content(string $content) protected function assert_no_content(string $content)