WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (3 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r40557 r42343  
    3535
    3636    public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() {
    37         $post_id = self::factory()->post->create();
    38         $prev_args = array(
     37        $post_id         = self::factory()->post->create();
     38        $prev_args       = array(
    3939            'comment_post_ID'      => $post_id,
    4040            'comment_content'      => 'Can we build it?',
     
    5959
    6060        // Approve the previous comment.
    61         wp_update_comment( array(
    62             'comment_ID'       => $prev_comment_id,
    63             'comment_approved' => 1,
    64         ) );
     61        wp_update_comment(
     62            array(
     63                'comment_ID'       => $prev_comment_id,
     64                'comment_approved' => 1,
     65            )
     66        );
    6567        $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
    6668        $this->assertTrue( $results );
     
    7880        $comment_type = '';
    7981
    80         update_option( 'moderation_keys',"foo\nbar\nscoop" );
     82        update_option( 'moderation_keys', "foo\nbar\nscoop" );
    8183        $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
    8284        $this->assertFalse( $results );
     
    9496        $comment_type = '';
    9597
    96         update_option( 'moderation_keys',"foo\nbar" );
     98        update_option( 'moderation_keys', "foo\nbar" );
    9799        $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
    98100        $this->assertTrue( $results );
     
    135137     */
    136138    public function test_should_return_true_when_comment_whitelist_is_enabled_and_user_has_previously_approved_comments_with_different_email() {
    137         $subscriber_id = $this->factory()->user->create( array(
    138             'role' => 'subscriber',
    139             'email' => 'sub@example.com',
    140         ) );
     139        $subscriber_id = $this->factory()->user->create(
     140            array(
     141                'role'  => 'subscriber',
     142                'email' => 'sub@example.com',
     143            )
     144        );
    141145
    142146        // Make sure comment author has an approved comment.
    143         $this->factory->comment->create( array( 'user_id' => $subscriber_id, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'sub@example.com' ) );
     147        $this->factory->comment->create(
     148            array(
     149                'user_id'              => $subscriber_id,
     150                'comment_approved'     => '1',
     151                'comment_author'       => 'foo',
     152                'comment_author_email' => 'sub@example.com',
     153            )
     154        );
    144155
    145         $subscriber_user = new WP_User( $subscriber_id );
     156        $subscriber_user             = new WP_User( $subscriber_id );
    146157        $subscriber_user->user_email = 'newsub@example.com';
    147158
     
    158169     */
    159170    public function test_should_return_false_when_comment_whitelist_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() {
    160         $subscriber_id = $this->factory()->user->create( array(
    161             'role' => 'subscriber',
    162             'email' => 'zig@example.com',
    163         ) );
     171        $subscriber_id = $this->factory()->user->create(
     172            array(
     173                'role'  => 'subscriber',
     174                'email' => 'zig@example.com',
     175            )
     176        );
    164177
    165         $subscriber_user = new WP_User( $subscriber_id );
     178        $subscriber_user             = new WP_User( $subscriber_id );
    166179        $subscriber_user->user_email = 'zag@example.com';
    167180
Note: See TracChangeset for help on using the changeset viewer.