This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/random_image/test.php

59 lines
1.5 KiB
PHP
Raw Normal View History

2009-07-20 05:51:36 +00:00
<?php
class RandomTest extends ShimmieWebTestCase {
function testRandom() {
$this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
$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
2012-03-09 22:08:55 +00:00
$raw = $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
$this->log_in_as_admin();
$this->delete_image($image_id);
$this->log_out();
}
2010-04-05 08:33:51 +00:00
2012-03-10 02:09:29 +00:00
function testPostListBlock() {
2010-04-05 08:33:51 +00:00
$this->log_in_as_admin();
$this->get_page("setup");
$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("ext/simpletest/data/pbx_screenshot.jpg", "test");
$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
}
?>