From cf6a533c74f5e336af7f72c243bcc85f4244cb00 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 5 Apr 2010 09:33:51 +0100 Subject: [PATCH] test random image block --- contrib/random_image/test.php | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/contrib/random_image/test.php b/contrib/random_image/test.php index ea6edae1..d9dbad0c 100644 --- a/contrib/random_image/test.php +++ b/contrib/random_image/test.php @@ -15,5 +15,41 @@ class RandomTest extends ShimmieWebTestCase { # FIXME: test random_image/download # FIXME: test random_image/ratio=4:3/download } + + function tesPostListBlock() { + $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"); + } } ?>