Fix broken `check_comment()` test.

The test `Tests_Comment_CheckComment::test_should_return_true_when_content_does_not_match_moderation_keys()`
did not, in fact, test for a `true` value, but for a false one.
Switching to `assertTrue()` caused a failure, because the test comment
triggered the 'comment_moderation' test. As in other tests in the file,
the solution is to force 'comment_moderation' to 0 for the purposes of
the test.

Introduced in [32519].

Props stephdau.
Fixes #40584.

git-svn-id: https://develop.svn.wordpress.org/trunk@40557 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2017-04-27 16:22:36 +00:00
parent 5d027d64fd
commit 7c4248b5e0
1 changed files with 3 additions and 1 deletions

View File

@ -83,6 +83,8 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
}
public function test_should_return_true_when_content_does_not_match_moderation_keys() {
update_option( 'comment_whitelist', 0 );
$author = 'WendytheBuilder';
$author_email = 'wendy@example.com';
$author_url = 'http://example.com';
@ -93,7 +95,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
update_option( 'moderation_keys',"foo\nbar" );
$results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
$this->assertFalse( $results );
$this->assertTrue( $results );
}
public function test_should_return_false_when_link_count_exceeds_comment_max_length_setting() {