tips tests
This commit is contained in:
parent
56446b867f
commit
9b9ef1a9ea
@ -1,10 +1,70 @@
|
||||
<?php
|
||||
class TipsTest extends SCoreWebTestCase {
|
||||
function testTips() {
|
||||
function setUp() {
|
||||
$this->log_in_as_admin();
|
||||
$raw = $this->get_page("tips/list");
|
||||
// get rid of the default data if it's there
|
||||
if(strpos($raw, "Delete")) {
|
||||
$this->click("Delete");
|
||||
}
|
||||
$this->log_out();
|
||||
}
|
||||
|
||||
function testImageless() {
|
||||
$this->log_in_as_admin();
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->assert_title("Tips List");
|
||||
$this->click("Save Settings");
|
||||
$this->set_field("image", "");
|
||||
$this->set_field("text", "an imageless tip");
|
||||
$this->click("Submit");
|
||||
$this->assert_title("Tips List");
|
||||
|
||||
$this->get_page("post/list");
|
||||
$this->assert_text("an imageless tip");
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->click("Delete");
|
||||
|
||||
$this->log_out();
|
||||
}
|
||||
|
||||
function testImaged() {
|
||||
$this->log_in_as_admin();
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->assert_title("Tips List");
|
||||
$this->set_field("image", "coins.png");
|
||||
$this->set_field("text", "an imaged tip");
|
||||
$this->click("Submit");
|
||||
$this->assert_title("Tips List");
|
||||
|
||||
$this->get_page("post/list");
|
||||
$this->assert_text("an imaged tip");
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->click("Delete");
|
||||
|
||||
$this->log_out();
|
||||
}
|
||||
|
||||
function testDisabled() {
|
||||
$this->log_in_as_admin();
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->assert_title("Tips List");
|
||||
$this->set_field("image", "coins.png");
|
||||
$this->set_field("text", "an imaged tip");
|
||||
$this->click("Submit");
|
||||
$this->click("Yes");
|
||||
$this->assert_title("Tips List");
|
||||
|
||||
$this->get_page("post/list");
|
||||
$this->assert_no_text("an imaged tip");
|
||||
|
||||
$this->get_page("tips/list");
|
||||
$this->click("Delete");
|
||||
|
||||
$this->log_out();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user