WordPress.org

Make WordPress Core

Changeset 40557


Ignore:
Timestamp:
04/27/2017 04:22:36 PM (21 months ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/checkComment.php

    r38738 r40557  
    8484
    8585    public function test_should_return_true_when_content_does_not_match_moderation_keys() {
     86        update_option( 'comment_whitelist', 0 );
     87
    8688        $author       = 'WendytheBuilder';
    8789        $author_email = 'wendy@example.com';
     
    9496        update_option( 'moderation_keys',"foo\nbar" );
    9597        $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
    96         $this->assertFalse( $results );
     98        $this->assertTrue( $results );
    9799    }
    98100
Note: See TracChangeset for help on using the changeset viewer.