2009-07-20 05:51:36 +00:00
|
|
|
<?php
|
2015-09-20 21:40:04 +00:00
|
|
|
class RandomTest extends ShimmiePHPUnitTestCase {
|
2015-09-26 10:17:13 +00:00
|
|
|
public function testRandom() {
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->log_in_as_user();
|
2015-08-09 11:14:28 +00:00
|
|
|
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->log_out();
|
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page("random_image/view");
|
|
|
|
$this->assert_title("Image $image_id: test");
|
2009-07-20 05:51:36 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page("random_image/view/test");
|
|
|
|
$this->assert_title("Image $image_id: test");
|
2010-04-05 08:14:54 +00:00
|
|
|
|
2015-09-20 21:40:04 +00:00
|
|
|
$this->get_page("random_image/download");
|
2010-04-05 08:14:54 +00:00
|
|
|
# FIXME: assert($raw == file(blah.jpg))
|
2009-07-20 05:51:36 +00:00
|
|
|
}
|
2010-04-05 08:33:51 +00:00
|
|
|
|
2015-09-26 10:17:13 +00:00
|
|
|
public function testPostListBlock() {
|
2010-04-05 08:33:51 +00:00
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->get_page("setup");
|
2015-09-20 21:40:04 +00:00
|
|
|
|
2015-09-21 09:05:32 +00:00
|
|
|
$this->markTestIncomplete();
|
2015-09-20 21:40:04 +00:00
|
|
|
|
2010-04-05 08:33:51 +00:00
|
|
|
$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();
|
2015-08-09 11:14:28 +00:00
|
|
|
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
2010-04-05 08:33:51 +00:00
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
# 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");
|
|
|
|
|
|
|
|
# disabled, image = no text
|
|
|
|
$this->get_page("post/list");
|
|
|
|
$this->assert_text("Random Image");
|
|
|
|
|
|
|
|
$this->delete_image($image_id);
|
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
# disabled, no image = no image
|
|
|
|
$this->get_page("post/list");
|
|
|
|
$this->assert_no_text("Random Image");
|
|
|
|
}
|
2009-07-20 05:51:36 +00:00
|
|
|
}
|
2014-04-26 02:54:51 +00:00
|
|
|
|