mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
Changes to the comment module to support spam filtering. Basically added two columns to the comment table. The url of the author's web site(default null) and a flag to indicate that the comment is visible (default true).
The comment block has changed to only display comments that are visible. And there is code added to call the spam_filter helper if the spam_filter module is installed.
This commit is contained in:
@@ -20,12 +20,52 @@
|
||||
class Comment_Helper_Test extends Unit_Test_Case {
|
||||
public function create_comment_test() {
|
||||
$rand = rand();
|
||||
$comment = comment::create($rand, $rand, $rand, $rand, $rand);
|
||||
$comment = comment::create($rand, $rand, $rand, $rand, $rand, $rand);
|
||||
|
||||
$this->assert_equal($rand, $comment->author);
|
||||
$this->assert_equal($rand, $comment->email);
|
||||
$this->assert_equal($rand, $comment->text);
|
||||
$this->assert_equal($rand, $comment->item_id);
|
||||
$this->assert_equal($rand, $comment->url);
|
||||
$this->assert_true(!empty($comment->created));
|
||||
}
|
||||
|
||||
public function update_comment_test() {
|
||||
$rand = rand();
|
||||
$comment = comment::create($rand, $rand, $rand, $rand, $rand, $rand);
|
||||
|
||||
$this->assert_equal($rand, $comment->author);
|
||||
$this->assert_equal($rand, $comment->email);
|
||||
$this->assert_equal($rand, $comment->text);
|
||||
$this->assert_equal($rand, $comment->item_id);
|
||||
$this->assert_equal($rand, $comment->url);
|
||||
$this->assert_true(!empty($comment->created));
|
||||
|
||||
$rand2 = rand();
|
||||
comment::update($comment, $rand2, $rand2, $rand2, $rand2, $rand2);
|
||||
$this->assert_equal($rand2, $comment->author);
|
||||
$this->assert_equal($rand2, $comment->email);
|
||||
$this->assert_equal($rand2, $comment->text);
|
||||
$this->assert_equal($rand, $comment->item_id);
|
||||
$this->assert_equal($rand2, $comment->url);
|
||||
}
|
||||
|
||||
public function update_comment_no_change_test() {
|
||||
$rand = rand();
|
||||
$comment = comment::create($rand, $rand, $rand, $rand, $rand, $rand);
|
||||
|
||||
$this->assert_equal($rand, $comment->author);
|
||||
$this->assert_equal($rand, $comment->email);
|
||||
$this->assert_equal($rand, $comment->text);
|
||||
$this->assert_equal($rand, $comment->item_id);
|
||||
$this->assert_equal($rand, $comment->url);
|
||||
$this->assert_true(!empty($comment->created));
|
||||
|
||||
comment::update($comment, $rand, $rand, $rand, $rand, $rand);
|
||||
$this->assert_equal($rand, $comment->author);
|
||||
$this->assert_equal($rand, $comment->email);
|
||||
$this->assert_equal($rand, $comment->text);
|
||||
$this->assert_equal($rand, $comment->item_id);
|
||||
$this->assert_equal($rand, $comment->url);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user