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

View file

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