2009-07-16 19:21:49 +00:00
|
|
|
<?php
|
|
|
|
class BanWordsTest extends ShimmieWebTestCase {
|
|
|
|
function testWordBan() {
|
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->get_page("setup");
|
2009-09-27 14:48:38 +00:00
|
|
|
$this->set_field("_config_banned_words", "viagra\nporn\n\n/http:.*\.cn\//");
|
2009-07-16 19:21:49 +00:00
|
|
|
$this->click("Save Settings");
|
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
|
|
|
|
|
|
|
|
$this->get_page("post/view/$image_id");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->set_field('comment', "kittens and viagra");
|
2009-07-16 19:21:49 +00:00
|
|
|
$this->click("Post Comment");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Comment Blocked");
|
2009-07-16 19:21:49 +00:00
|
|
|
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->get_page("post/view/$image_id");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->set_field('comment', "kittens and ViagrA");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->click("Post Comment");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Comment Blocked");
|
2009-07-20 05:51:36 +00:00
|
|
|
|
|
|
|
$this->get_page("post/view/$image_id");
|
2009-09-27 14:48:38 +00:00
|
|
|
$this->set_field('comment', "kittens and viagra!");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->click("Post Comment");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Comment Blocked");
|
2009-07-20 05:51:36 +00:00
|
|
|
|
2009-07-16 19:21:49 +00:00
|
|
|
$this->get_page("post/view/$image_id");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->set_field('comment', "some link to http://something.cn/");
|
2009-07-16 19:21:49 +00:00
|
|
|
$this->click("Post Comment");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Comment Blocked");
|
2009-07-16 19:21:49 +00:00
|
|
|
|
|
|
|
$this->get_page('comment/list');
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title('Comments');
|
|
|
|
$this->assert_no_text('viagra');
|
|
|
|
$this->assert_no_text('ViagrA');
|
|
|
|
$this->assert_no_text('http://something.cn/');
|
2009-07-16 19:21:49 +00:00
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->delete_image($image_id);
|
|
|
|
$this->log_out();
|
|
|
|
}
|
|
|
|
}
|
2014-04-25 02:34:45 +00:00
|
|
|
|