Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (6 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/xmlrpc/wp/editComment.php

    r40417 r42343  
    88    function test_author_can_edit_own_comment() {
    99        $author_id = $this->make_user_by_role( 'author' );
    10         $post_id = self::factory()->post->create( array(
    11             'post_title' => 'Post test by author',
    12             'post_author' => $author_id
    13         ) );
     10        $post_id   = self::factory()->post->create(
     11            array(
     12                'post_title'  => 'Post test by author',
     13                'post_author' => $author_id,
     14            )
     15        );
    1416
    15         $comment_id = wp_insert_comment(array(
    16             'comment_post_ID' => $post_id,
    17             'comment_author' => 'Commenter 1',
    18             'comment_author_url' => "http://example.com/1/",
    19             'comment_approved' => 1,
    20         ));
     17        $comment_id = wp_insert_comment(
     18            array(
     19                'comment_post_ID'    => $post_id,
     20                'comment_author'     => 'Commenter 1',
     21                'comment_author_url' => 'http://example.com/1/',
     22                'comment_approved'   => 1,
     23            )
     24        );
    2125
    22         $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array(
    23             'status' => 'hold'
    24         ) ) );
     26        $result = $this->myxmlrpcserver->wp_editComment(
     27            array(
     28                1,
     29                'author',
     30                'author',
     31                $comment_id,
     32                array(
     33                    'status' => 'hold',
     34                ),
     35            )
     36        );
    2537        $this->assertNotIXRError( $result );
    2638        $this->assertTrue( $result );
     
    3042        $this->make_user_by_role( 'author' );
    3143        $editor_id = $this->make_user_by_role( 'editor' );
    32         $post_id = self::factory()->post->create( array(
    33             'post_title' => 'Post test by editor',
    34             'post_author' => $editor_id
    35         ) );
     44        $post_id   = self::factory()->post->create(
     45            array(
     46                'post_title'  => 'Post test by editor',
     47                'post_author' => $editor_id,
     48            )
     49        );
    3650
    37         $comment_id = wp_insert_comment( array(
    38             'comment_post_ID' => $post_id,
    39             'comment_author' => 'Commenter 2',
    40             'comment_author_url' => 'http://example.com/2/',
    41             'comment_approved' => 0,
    42         ) );
     51        $comment_id = wp_insert_comment(
     52            array(
     53                'comment_post_ID'    => $post_id,
     54                'comment_author'     => 'Commenter 2',
     55                'comment_author_url' => 'http://example.com/2/',
     56                'comment_approved'   => 0,
     57            )
     58        );
    4359
    4460        $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 'status' => 'hold' ) ) );
     
    5369
    5470        $comment_data = array(
    55             'comment_post_ID' => $post_id,
    56             'comment_author' => 'Test commenter',
    57             'comment_author_url' => 'http://example.com/',
     71            'comment_post_ID'      => $post_id,
     72            'comment_author'       => 'Test commenter',
     73            'comment_author_url'   => 'http://example.com/',
    5874            'comment_author_email' => 'example@example.com',
    59             'comment_content' => 'Comment content',
    60             'comment_approved' => '1'
     75            'comment_content'      => 'Comment content',
     76            'comment_approved'     => '1',
    6177        );
    62         $comment_id = wp_insert_comment( $comment_data );
     78        $comment_id   = wp_insert_comment( $comment_data );
    6379
    6480        $this->assertEquals( '1', get_comment( $comment_id )->comment_approved );
    6581
    66         $this->myxmlrpcserver->wp_editComment( array( 1, 'administrator', 'administrator', $comment_id, array(
    67             'status' => 'trash'
    68         ) ) );
     82        $this->myxmlrpcserver->wp_editComment(
     83            array(
     84                1,
     85                'administrator',
     86                'administrator',
     87                $comment_id,
     88                array(
     89                    'status' => 'trash',
     90                ),
     91            )
     92        );
    6993
    7094        $this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved );
Note: See TracChangeset for help on using the changeset viewer.