Make WordPress Core


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

    r40417 r42343  
    88
    99    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    10         self::$post_id = $factory->post->create( array(
    11             'post_type'   => 'page',
    12             'post_author' => $factory->user->create( array(
    13                 'user_login' => 'author',
    14                 'user_pass'  => 'author',
    15                 'role'       => 'author'
    16             ) ),
    17             'post_date'   => strftime( "%Y-%m-%d %H:%M:%S", strtotime( '+1 day' ) ),
    18         ) );
     10        self::$post_id = $factory->post->create(
     11            array(
     12                'post_type'   => 'page',
     13                'post_author' => $factory->user->create(
     14                    array(
     15                        'user_login' => 'author',
     16                        'user_pass'  => 'author',
     17                        'role'       => 'author',
     18                    )
     19                ),
     20                'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
     21            )
     22        );
    1923    }
    2024
     
    4751        add_theme_support( 'post-thumbnails' );
    4852
    49         $fields = array( 'post' );
     53        $fields  = array( 'post' );
    5054        $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
    5155        $this->assertNotIXRError( $results );
    5256
    53         foreach( $results as $result ) {
     57        foreach ( $results as $result ) {
    5458            $post = get_post( $result['postid'] );
    5559
     
    6165            $this->assertInternalType( 'string', $result['link'] );
    6266            $this->assertInternalType( 'string', $result['permaLink'] );
    63             $this->assertInternalType( 'array',  $result['categories'] );
     67            $this->assertInternalType( 'array', $result['categories'] );
    6468            $this->assertInternalType( 'string', $result['mt_excerpt'] );
    6569            $this->assertInternalType( 'string', $result['mt_text_more'] );
     
    9599
    96100        // create attachment
    97         $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
     101        $filename      = ( DIR_TESTDATA . '/images/a2-small.jpg' );
    98102        $attachment_id = self::factory()->attachment->create_upload_object( $filename, self::$post_id );
    99103        set_post_thumbnail( self::$post_id, $attachment_id );
     
    102106        $this->assertNotIXRError( $results );
    103107
    104         foreach( $results as $result ) {
     108        foreach ( $results as $result ) {
    105109            $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
    106110            $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
    107111
    108             if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == self::$post_id ) {
     112            if ( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == self::$post_id ) {
    109113                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
    110114
     
    122126        $this->assertNotIXRError( $results );
    123127
    124         foreach( $results as $result ) {
    125             $post = get_post( $result['postid'] );
    126             $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_date, false ), 'Ymd\TH:i:s' ) );
     128        foreach ( $results as $result ) {
     129            $post              = get_post( $result['postid'] );
     130            $date_gmt          = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_date, false ), 'Ymd\TH:i:s' ) );
    127131            $date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_modified, false ), 'Ymd\TH:i:s' ) );
    128132
Note: See TracChangeset for help on using the changeset viewer.