Permalink
Browse files

Added: unit tests for content checking.

  • Loading branch information...
1 parent cb62088 commit cff0d937bfdcc1eaad2c5955a2bd3282089e1fba Matthias Vandermaesen committed Nov 6, 2011
Showing with 27 additions and 7 deletions.
  1. +27 −7 tests/check_comment_test.php
@@ -2,14 +2,14 @@
/**
* This suite tests check_comment filter.
- *
+ *
* This is a set of tests to check whether or not comment filtering happens
* consistently.
- *
+ *
* If you want to run these, you'll need PHP Unit and the Wordpress Tests project.
* @link https://github.com/nb/wordpress-tests
*/
-class Mollom_Test_Check_Comment extends WP_UnitTestCase {
+class WP_Test_Check_Comment extends WP_UnitTestCase {
public $plugin_slug = 'wp-mollom';
@@ -18,15 +18,35 @@ class Mollom_Test_Check_Comment extends WP_UnitTestCase {
public function setUp() {
parent::setUp();
-
+
$this->wpmollom = WPMollom::getInstance();
$this->comment = array(
-
+ 'comment_post_ID' => 1,
+ 'comment_author' => 'admin',
+ 'comment_author_email' => 'author@domain.tld',
+ 'comment_author_url' => 'http://authorsite.tld',
+ 'comment_content' => 'comment content',
+ 'comment_type' => '',
+ 'comment_parent' => 0,
+ 'user_ID'=> 1,
);
}
public function test_check_ham_comment() {
+ $this->comment['comment_content'] = 'ham';
+ $result = $this->wpmollom->check_comment($this->comment);
+ $this->assertEquals($result, $this->comment);
+ }
+
+ public function test_check_spam_comment() {
+ $this->comment['comment_content'] = 'spam';
+ $result = $this->wpmollom->check_comment($this->comment);
+ $this->assertEquals($result, $this->comment);
+ }
+
+ public function test_check_unsure_comment() {
+ $this->comment['comment_content'] = 'unsure';
+ $result = $this->wpmollom->check_comment($this->comment);
+ $this->assertEquals($result, $this->comment);
}
-
-
}

0 comments on commit cff0d93

Please sign in to comment.