Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#40584 closed defect (bug) (fixed)

Missing `comment_whitelist` reset in `Tests_Comment_CheckComment::test_should_return_true_when_content_does_not_match_moderation_keys`

Reported by: stephdau's profile stephdau Owned by: boonebgorges's profile boonebgorges
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch
Focuses: Cc:


I came to @boone with a question about this test because I could not wrap my head around why it would be asserting False when the name indicates it should assert true.

He investigated a bit, and found that the test is missing a update_option( 'comment_whitelist', 0 );, as done in the previous test.

Creating a ticket to implement his findings.

Original Slack discussion at

Attachments (1)

40584.diff (890 bytes) - added by stephdau 7 years ago.
Adding required update_option( 'comment_whitelist', 0 );, and switching to rightful $this->assertTrue( $results );

Download all attachments as: .zip

Change History (4)

7 years ago

Adding required update_option( 'comment_whitelist', 0 );, and switching to rightful $this->assertTrue( $results );

#1 @stephdau
7 years ago

  • Keywords has-patch added

#2 @boonebgorges
7 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 40557:

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.

#3 @boonebgorges
7 years ago

  • Milestone changed from Awaiting Review to 4.8
Note: See TracTickets for help on using tickets.