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');
send_event($bae);
$this->assertContains(
$this->assertStringContainsString(
"Error, asdf is not a readable directory",
$bae->results,
implode("\n", $bae->results)

View File

@ -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

View File

@ -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(
'<meta name="description" content="A Shimmie testbed">',
$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(
'<meta name="keywords" content="foo,bar,baz">',
$page->get_all_html_headers()
);

View File

@ -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());
}
}