fix all the tests (for sqlite, php7.4, osx, at least)

This commit is contained in:
Shish
2020-01-28 21:19:59 +00:00
parent ac1076b3f3
commit 615da9e9d2
57 changed files with 665 additions and 859 deletions

View File

@@ -1,5 +1,5 @@
<?php declare(strict_types=1);
class RandomTest extends ShimmiePHPUnitTestCase
class RandomImageTest extends ShimmiePHPUnitTestCase
{
public function testRandom()
{
@@ -7,53 +7,41 @@ class RandomTest extends ShimmiePHPUnitTestCase
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
$this->log_out();
$this->get_page("random_image/view");
$this->assert_title("Image $image_id: test");
$page = $this->get_page("random_image/view");
$this->assertEquals("Image $image_id: test", $page->title);
$this->get_page("random_image/view/test");
$this->assert_title("Image $image_id: test");
$page = $this->get_page("random_image/view/test");
$this->assertEquals("Image $image_id: test", $page->title);
$this->get_page("random_image/download");
$page = $this->get_page("random_image/download");
$this->assertNotNull($page->data);
# FIXME: assert($raw == file(blah.jpg))
}
public function testPostListBlock()
{
global $config;
$this->log_in_as_admin();
$this->get_page("setup");
$this->markTestIncomplete();
$this->set_field("_config_show_random_block", true);
$this->click("Save Settings");
$this->log_out();
# enabled, no image = no text
$this->get_page("post/list");
$this->assert_no_text("Random Image");
$this->log_in_as_user();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
$this->log_out();
$config->set_bool("show_random_block", true);
$page = $this->get_page("post/list");
$this->assertNull($page->find_block("Random Image"));
# enabled, image = text
$this->get_page("post/list");
$this->assert_text("Random Image");
$this->log_in_as_admin();
$this->get_page("setup");
$this->set_field("_config_show_random_block", true);
$this->click("Save Settings");
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
$page = $this->get_page("post/list");
$this->assertNotNull($page->find_block("Random Image"));
# disabled, image = no text
$this->get_page("post/list");
$this->assert_text("Random Image");
$this->delete_image($image_id);
$this->log_out();
$config->set_bool("show_random_block", false);
$page = $this->get_page("post/list");
$this->assertNull($page->find_block("Random Image"));
# disabled, no image = no image
$this->get_page("post/list");
$this->assert_no_text("Random Image");
$this->delete_image($image_id);
$page = $this->get_page("post/list");
$this->assertNull($page->find_block("Random Image"));
}
}