From 7c4248b5e01a4162d04e93a4db09702a1e2dde20 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 27 Apr 2017 16:22:36 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/comment/checkComment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/comment/checkComment.php b/tests/phpunit/tests/comment/checkComment.php index 0bedc4a919..b33ccd7439 100644 --- a/tests/phpunit/tests/comment/checkComment.php +++ b/tests/phpunit/tests/comment/checkComment.php @@ -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() {