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/term/getTermLink.php

    r35242 r42343  
    1313
    1414    public function test_integer_should_be_interpreted_as_term_id() {
    15         $t1 = self::factory()->term->create( array(
    16             'taxonomy' => 'wptests_tax',
    17             'name' => 'foo',
    18         ) );
    19         $t2 = self::factory()->term->create( array(
    20             'taxonomy' => 'wptests_tax',
    21             'slug' => $t1,
    22         ) );
     15        $t1 = self::factory()->term->create(
     16            array(
     17                'taxonomy' => 'wptests_tax',
     18                'name'     => 'foo',
     19            )
     20        );
     21        $t2 = self::factory()->term->create(
     22            array(
     23                'taxonomy' => 'wptests_tax',
     24                'slug'     => $t1,
     25            )
     26        );
    2327
    2428        $term = intval( $t1 );
     
    2933
    3034    public function test_numeric_string_should_be_interpreted_as_term_slug() {
    31         $t1 = self::factory()->term->create( array(
    32             'taxonomy' => 'wptests_tax',
    33             'name' => 'foo',
    34         ) );
    35         $t2 = self::factory()->term->create( array(
    36             'taxonomy' => 'wptests_tax',
    37             'slug' => $t1,
    38         ) );
     35        $t1 = self::factory()->term->create(
     36            array(
     37                'taxonomy' => 'wptests_tax',
     38                'name'     => 'foo',
     39            )
     40        );
     41        $t2 = self::factory()->term->create(
     42            array(
     43                'taxonomy' => 'wptests_tax',
     44                'slug'     => $t1,
     45            )
     46        );
    3947
    4048        $term = (string) $t1;
     
    5765
    5866    public function test_taxonomy_with_query_var_should_use_that_query_var_with_term_slug() {
    59         register_taxonomy( 'wptests_tax2', 'post', array(
    60             'query_var' => 'foo',
    61         ) );
     67        register_taxonomy(
     68            'wptests_tax2', 'post', array(
     69                'query_var' => 'foo',
     70            )
     71        );
    6272
    63         $t = self::factory()->term->create( array(
    64             'taxonomy' => 'wptests_tax2',
    65             'slug' => 'bar',
    66         ) );
     73        $t = self::factory()->term->create(
     74            array(
     75                'taxonomy' => 'wptests_tax2',
     76                'slug'     => 'bar',
     77            )
     78        );
    6779
    6880        $actual = get_term_link( $t, 'wptests_tax2' );
     
    7183
    7284    public function test_taxonomy_without_query_var_should_use_taxonomy_query_var_and_term_query_var_with_term_slug() {
    73         register_taxonomy( 'wptests_tax2', 'post', array(
    74             'query_var' => false,
    75         ) );
     85        register_taxonomy(
     86            'wptests_tax2', 'post', array(
     87                'query_var' => false,
     88            )
     89        );
    7690
    77         $t = self::factory()->term->create( array(
    78             'taxonomy' => 'wptests_tax2',
    79             'slug' => 'bar',
    80         ) );
     91        $t = self::factory()->term->create(
     92            array(
     93                'taxonomy' => 'wptests_tax2',
     94                'slug'     => 'bar',
     95            )
     96        );
    8197
    8298        $actual = get_term_link( $t, 'wptests_tax2' );
     
    88104        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    89105
    90         register_taxonomy( 'wptests_tax2', 'post', array(
    91             'hierarchical' => true,
    92             'rewrite' => array(
    93                 'slug' => 'foo',
     106        register_taxonomy(
     107            'wptests_tax2', 'post', array(
    94108                'hierarchical' => true,
    95             ),
    96         ) );
     109                'rewrite'      => array(
     110                    'slug'         => 'foo',
     111                    'hierarchical' => true,
     112                ),
     113            )
     114        );
    97115
    98116        flush_rewrite_rules();
    99117
    100         $t1 = self::factory()->term->create( array(
    101             'taxonomy' => 'wptests_tax2',
    102             'slug' => 'term1',
    103         ) );
     118        $t1 = self::factory()->term->create(
     119            array(
     120                'taxonomy' => 'wptests_tax2',
     121                'slug'     => 'term1',
     122            )
     123        );
    104124
    105         $t2 = self::factory()->term->create( array(
    106             'taxonomy' => 'wptests_tax2',
    107             'slug' => 'term2',
    108             'parent' => $t1,
    109         ) );
     125        $t2 = self::factory()->term->create(
     126            array(
     127                'taxonomy' => 'wptests_tax2',
     128                'slug'     => 'term2',
     129                'parent'   => $t1,
     130            )
     131        );
    110132
    111133        $actual = get_term_link( $t2, 'wptests_tax2' );
     
    117139        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    118140
    119         register_taxonomy( 'wptests_tax2', 'post', array(
    120             'hierarchical' => true,
    121             'rewrite' => array(
    122                 'slug' => 'foo',
    123                 'hierarchical' => false,
    124             ),
    125         ) );
     141        register_taxonomy(
     142            'wptests_tax2', 'post', array(
     143                'hierarchical' => true,
     144                'rewrite'      => array(
     145                    'slug'         => 'foo',
     146                    'hierarchical' => false,
     147                ),
     148            )
     149        );
    126150
    127151        flush_rewrite_rules();
    128152
    129         $t1 = self::factory()->term->create( array(
    130             'taxonomy' => 'wptests_tax2',
    131             'slug' => 'term1',
    132         ) );
     153        $t1 = self::factory()->term->create(
     154            array(
     155                'taxonomy' => 'wptests_tax2',
     156                'slug'     => 'term1',
     157            )
     158        );
    133159
    134         $t2 = self::factory()->term->create( array(
    135             'taxonomy' => 'wptests_tax2',
    136             'slug' => 'term2',
    137             'parent' => $t1,
    138         ) );
     160        $t2 = self::factory()->term->create(
     161            array(
     162                'taxonomy' => 'wptests_tax2',
     163                'slug'     => 'term2',
     164                'parent'   => $t1,
     165            )
     166        );
    139167
    140168        $actual = get_term_link( $t2, 'wptests_tax2' );
Note: See TracChangeset for help on using the changeset viewer.