Make WordPress Core


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

    r36077 r42343  
    1919        add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
    2020        $_SERVER['REQUEST_URI'] = '/woohoo';
    21         $paged = get_pagenum_link( 2 );
     21        $paged                  = get_pagenum_link( 2 );
    2222
    2323        remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
     
    2828
    2929    function test_wp_get_shortlink() {
    30         $post_id = self::factory()->post->create();
     30        $post_id  = self::factory()->post->create();
    3131        $post_id2 = self::factory()->post->create();
    3232
     
    102102     */
    103103    public function test_get_permalink_should_not_reveal_post_name_for_post_with_post_status_future() {
    104         update_option( 'permalink_structure','/%year%/%monthnum%/%day%/%postname%/' );
     104        update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
    105105
    106106        flush_rewrite_rules();
    107107
    108         $p = self::factory()->post->create( array(
    109             'post_status' => 'publish',
    110             'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) )
    111         ) );
     108        $p = self::factory()->post->create(
     109            array(
     110                'post_status' => 'publish',
     111                'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
     112            )
     113        );
    112114
    113115        $non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) );
     
    120122     */
    121123    public function test_get_permalink_should_not_reveal_post_name_for_cpt_with_post_status_future() {
    122         update_option( 'permalink_structure','/%year%/%monthnum%/%day%/%postname%/' );
     124        update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
    123125
    124126        register_post_type( 'wptests_pt', array( 'public' => true ) );
     
    126128        flush_rewrite_rules();
    127129
    128         $p = self::factory()->post->create( array(
    129             'post_status' => 'future',
    130             'post_type'   => 'wptests_pt',
    131             'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) )
    132         ) );
    133 
    134         $non_pretty_permalink = add_query_arg( array(
    135             'post_type' => 'wptests_pt',
    136             'p' => $p,
    137         ), trailingslashit( home_url() ) );
     130        $p = self::factory()->post->create(
     131            array(
     132                'post_status' => 'future',
     133                'post_type'   => 'wptests_pt',
     134                'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
     135            )
     136        );
     137
     138        $non_pretty_permalink = add_query_arg(
     139            array(
     140                'post_type' => 'wptests_pt',
     141                'p'         => $p,
     142            ), trailingslashit( home_url() )
     143        );
    138144
    139145        $this->assertEquals( $non_pretty_permalink, get_permalink( $p ) );
     
    146152        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    147153
    148         $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array(
    149             'post_mime_type' => 'image/jpeg',
    150             'post_type' => 'attachment',
    151             'post_title' => 'An Attachment!',
    152             'post_status' => 'inherit',
    153         ) );
     154        $attachment_id = self::factory()->attachment->create_object(
     155            'image.jpg', 0, array(
     156                'post_mime_type' => 'image/jpeg',
     157                'post_type'      => 'attachment',
     158                'post_title'     => 'An Attachment!',
     159                'post_status'    => 'inherit',
     160            )
     161        );
    154162
    155163        $attachment = get_post( $attachment_id );
     
    172180        $post_id = self::factory()->post->create( array( 'post_type' => 'not_a_post_type' ) );
    173181
    174         $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    175             'post_mime_type' => 'image/jpeg',
    176             'post_type' => 'attachment',
    177             'post_title' => 'An Attachment!',
    178             'post_status' => 'inherit',
    179         ) );
     182        $attachment_id = self::factory()->attachment->create_object(
     183            'image.jpg', $post_id, array(
     184                'post_mime_type' => 'image/jpeg',
     185                'post_type'      => 'attachment',
     186                'post_title'     => 'An Attachment!',
     187                'post_status'    => 'inherit',
     188            )
     189        );
    180190
    181191        $attachment = get_post( $attachment_id );
     
    183193        $this->assertSame( get_permalink( $post_id ) . user_trailingslashit( $attachment->post_name ), get_permalink( $attachment_id ) );
    184194
    185         foreach( $wp_post_types as $id => $pt ) {
     195        foreach ( $wp_post_types as $id => $pt ) {
    186196            if ( 'not_a_post_type' === $pt->name ) {
    187197                unset( $wp_post_types[ $id ] );
Note: See TracChangeset for help on using the changeset viewer.