Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (9 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/mw/newPost.php

    r40417 r42343  
    77
    88        function test_invalid_username_password() {
    9                 $post = array();
     9                $post   = array();
    1010                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) );
    1111                $this->assertIXRError( $result );
     
    1616                $this->make_user_by_role( 'subscriber' );
    1717
    18                 $post = array();
     18                $post   = array();
    1919                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
    2020                $this->assertIXRError( $result );
     
    2525                $this->make_user_by_role( 'author' );
    2626
    27                 $post = array();
     27                $post   = array();
    2828                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    2929                $this->assertIXRError( $result );
     
    3535                $this->make_user_by_role( 'author' );
    3636
    37                 $post = array( 'title' => 'Test' );
     37                $post   = array( 'title' => 'Test' );
    3838                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    3939                $this->assertNotIXRError( $result );
     
    4444                $this->make_user_by_role( 'author' );
    4545
    46                 $post = array( 'title' => 'Test', 'ID' => 103948 );
     46                $post   = array(
     47                        'title' => 'Test',
     48                        'ID'    => 103948,
     49                );
    4750                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    4851                $this->assertNotIXRError( $result );
     
    5356                $this->make_user_by_role( 'author' );
    5457
    55                 $post = array( 'title' => 'Test', 'post_status' => 'publish' );
     58                $post   = array(
     59                        'title'       => 'Test',
     60                        'post_status' => 'publish',
     61                );
    5662                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    5763                $this->assertNotIXRError( $result );
     
    6167                $this->make_user_by_role( 'contributor' );
    6268
    63                 $post = array( 'title' => 'Test', 'post_status' => 'publish' );
     69                $post   = array(
     70                        'title'       => 'Test',
     71                        'post_status' => 'publish',
     72                );
    6473                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
    6574                $this->assertIXRError( $result );
     
    7180                $other_author_id = $this->make_user_by_role( 'author' );
    7281
    73                 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
     82                $post   = array(
     83                        'title'        => 'Test',
     84                        'wp_author_id' => $other_author_id,
     85                );
    7486                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    7587                $this->assertNotIXRError( $result );
     
    8092                $other_author_id = $this->make_user_by_role( 'author' );
    8193
    82                 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
     94                $post   = array(
     95                        'title'        => 'Test',
     96                        'wp_author_id' => $other_author_id,
     97                );
    8398                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
    8499                $this->assertIXRError( $result );
     
    92107                $this->make_user_by_role( 'editor' );
    93108
    94                 $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
     109                $post   = array(
     110                        'title'        => 'Test',
     111                        'wp_author_id' => 99999999,
     112                );
    95113                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    96114                $this->assertIXRError( $result );
     
    101119                $my_author_id = $this->make_user_by_role( 'author' );
    102120
    103                 $post = array( 'title' => 'Test' );
     121                $post   = array( 'title' => 'Test' );
    104122                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    105123                $this->assertNotIXRError( $result );
     
    117135
    118136                // create attachment
    119                 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
     137                $filename      = ( DIR_TESTDATA . '/images/a2-small.jpg' );
    120138                $attachment_id = self::factory()->attachment->create_upload_object( $filename );
    121139
    122                 $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
     140                $post   = array(
     141                        'title'             => 'Post Thumbnail Test',
     142                        'wp_post_thumbnail' => $attachment_id,
     143                );
    123144                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    124145                $this->assertNotIXRError( $result );
     
    131152                $this->make_user_by_role( 'author' );
    132153
    133                 $post = array( 'title' => 'Test', 'post_type' => 'page' );
     154                $post   = array(
     155                        'title'     => 'Test',
     156                        'post_type' => 'page',
     157                );
    134158                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    135159                $this->assertIXRError( $result );
     
    140164                $this->make_user_by_role( 'editor' );
    141165
    142                 $post = array( 'title' => 'Test', 'post_type' => 'page' );
     166                $post   = array(
     167                        'title'     => 'Test',
     168                        'post_type' => 'page',
     169                );
    143170                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    144171                $this->assertNotIXRError( $result );
     
    157184                $this->make_user_by_role( 'editor' );
    158185
    159                 $post = array(
    160                         'title' => 'Test',
    161                         'post_type' => 'post',
    162                         'post_status' => 'draft'
     186                $post   = array(
     187                        'title'       => 'Test',
     188                        'post_type'   => 'post',
     189                        'post_status' => 'draft',
    163190                );
    164191                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
Note: See TracChangeset for help on using the changeset viewer.