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/rewrite/oldSlugRedirect.php

    r37075 r42343  
    1313        parent::setUp();
    1414
    15         $this->post_id = self::factory()->post->create( array(
    16             'post_title'   => 'Foo Bar',
    17             'post_name'   => 'foo-bar',
    18         ) );
     15        $this->post_id = self::factory()->post->create(
     16            array(
     17                'post_title' => 'Foo Bar',
     18                'post_name'  => 'foo-bar',
     19            )
     20        );
    1921
    2022        add_filter( 'old_slug_redirect_url', array( $this, 'filter_old_slug_redirect_url' ), 10, 1 );
     
    3941        $old_permalink = user_trailingslashit( get_permalink( $this->post_id ) );
    4042
    41         wp_update_post( array(
    42             'ID' => $this->post_id,
    43             'post_name' => 'bar-baz',
    44         ) );
     43        wp_update_post(
     44            array(
     45                'ID'        => $this->post_id,
     46                'post_name' => 'bar-baz',
     47            )
     48        );
    4549
    4650        $permalink = user_trailingslashit( get_permalink( $this->post_id ) );
     
    5357    public function test_old_slug_redirect_attachment() {
    5458        $file          = DIR_TESTDATA . '/images/canola.jpg';
    55         $attachment_id = self::factory()->attachment->create_object( $file, $this->post_id, array(
    56             'post_mime_type' => 'image/jpeg',
    57             'post_name'      => 'my-attachment',
    58         ) );
     59        $attachment_id = self::factory()->attachment->create_object(
     60            $file, $this->post_id, array(
     61                'post_mime_type' => 'image/jpeg',
     62                'post_name'      => 'my-attachment',
     63            )
     64        );
    5965
    6066        $old_permalink = get_attachment_link( $attachment_id );
    6167
    62         wp_update_post( array(
    63             'ID' => $this->post_id,
    64             'post_name' => 'bar-baz',
    65         ) );
     68        wp_update_post(
     69            array(
     70                'ID'        => $this->post_id,
     71                'post_name' => 'bar-baz',
     72            )
     73        );
    6674
    6775        $this->go_to( $old_permalink );
     
    7280        $old_permalink = get_attachment_link( $attachment_id );
    7381
    74         wp_update_post( array(
    75             'ID' => $attachment_id,
    76             'post_name' => 'the-attachment',
    77         ) );
     82        wp_update_post(
     83            array(
     84                'ID'        => $attachment_id,
     85                'post_name' => 'the-attachment',
     86            )
     87        );
    7888
    7989        $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'the-attachment' );
     
    8595
    8696    public function test_old_slug_redirect_paged() {
    87         wp_update_post( array(
    88             'ID' => $this->post_id,
    89             'post_content' => 'Test<!--nextpage-->Test',
    90         ) );
     97        wp_update_post(
     98            array(
     99                'ID'           => $this->post_id,
     100                'post_content' => 'Test<!--nextpage-->Test',
     101            )
     102        );
    91103
    92104        $old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'page/2' );
    93105
    94         wp_update_post( array(
    95             'ID' => $this->post_id,
    96             'post_name' => 'bar-baz',
    97         ) );
     106        wp_update_post(
     107            array(
     108                'ID'        => $this->post_id,
     109                'post_name' => 'bar-baz',
     110            )
     111        );
    98112
    99113        $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'page/2' );
     
    110124        $old_permalink = user_trailingslashit( get_permalink( $this->post_id ) );
    111125
    112         wp_update_post( array(
    113             'ID' => $this->post_id,
    114             'post_name' => 'bar-baz',
    115         ) );
     126        wp_update_post(
     127            array(
     128                'ID'        => $this->post_id,
     129                'post_name' => 'bar-baz',
     130            )
     131        );
    116132
    117         $new_post_id = self::factory()->post->create( array(
    118             'post_title'   => 'Foo Bar',
    119             'post_name'   => 'foo-bar',
    120         ) );
     133        $new_post_id = self::factory()->post->create(
     134            array(
     135                'post_title' => 'Foo Bar',
     136                'post_name'  => 'foo-bar',
     137            )
     138        );
    121139
    122140        $permalink = user_trailingslashit( get_permalink( $new_post_id ) );
Note: See TracChangeset for help on using the changeset viewer.