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

@@ -4,86 +4,62 @@ class TipsTest extends ShimmiePHPUnitTestCase
public function setUp(): void
{
parent::setUp();
$this->log_in_as_admin();
$this->get_page("tips/list");
$this->markTestIncomplete();
// get rid of the default data if it's there
if (strpos($this->page_to_text(), "Delete")) {
$this->click("Delete");
}
$this->log_out();
// Delete default tips so we can test from a blank slate
global $database;
$database->execute("DELETE FROM tips");
}
public function testImageless()
{
global $database;
$this->log_in_as_admin();
$this->get_page("tips/list");
$this->assert_title("Tips List");
$this->markTestIncomplete();
$this->set_field("image", "");
$this->set_field("text", "an imageless tip");
$this->click("Submit");
$this->assert_title("Tips List");
send_event(new CreateTipEvent(true, "", "an imageless tip"));
$this->get_page("post/list");
$this->assert_text("an imageless tip");
$this->get_page("tips/list");
$this->click("Delete");
$this->log_out();
$tip_id = (int)$database->get_one("SELECT id FROM tips");
send_event(new DeleteTipEvent($tip_id));
$this->get_page("post/list");
$this->assert_no_text("an imageless tip");
}
public function testImaged()
{
global $database;
$this->log_in_as_admin();
$this->get_page("tips/list");
$this->assert_title("Tips List");
$this->markTestIncomplete();
$this->set_field("image", "coins.png");
$this->set_field("text", "an imaged tip");
$this->click("Submit");
$this->assert_title("Tips List");
send_event(new CreateTipEvent(true, "coins.png", "an imageless tip"));
$this->get_page("post/list");
$this->assert_text("an imaged tip");
$this->assert_text("an imageless tip");
$this->get_page("tips/list");
$this->click("Delete");
$this->log_out();
$tip_id = (int)$database->get_one("SELECT id FROM tips");
send_event(new DeleteTipEvent($tip_id));
$this->get_page("post/list");
$this->assert_no_text("an imageless tip");
}
public function testDisabled()
{
global $database;
$this->log_in_as_admin();
$this->get_page("tips/list");
$this->assert_title("Tips List");
$this->markTestIncomplete();
$this->set_field("image", "coins.png");
$this->set_field("text", "an imaged tip");
$this->click("Submit");
$this->click("Yes");
$this->assert_title("Tips List");
send_event(new CreateTipEvent(false, "", "an imageless tip"));
$this->get_page("post/list");
$this->assert_no_text("an imaged tip");
$this->assert_no_text("an imageless tip");
$this->get_page("tips/list");
$this->click("Delete");
$this->log_out();
$tip_id = (int)$database->get_one("SELECT id FROM tips");
send_event(new DeleteTipEvent($tip_id));
$this->get_page("post/list");
$this->assert_no_text("an imageless tip");
}
}