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

    r35242 r42343  
    1212
    1313    public function test_unique_slug_should_be_unchanged() {
    14         $term = self::factory()->term->create_and_get( array(
    15             'taxonomy' => 'wptests_tax1',
    16             'name' => 'foo',
    17             'slug' => 'foo',
    18         ) );
     14        $term = self::factory()->term->create_and_get(
     15            array(
     16                'taxonomy' => 'wptests_tax1',
     17                'name'     => 'foo',
     18                'slug'     => 'foo',
     19            )
     20        );
    1921
    2022        $actual = wp_unique_term_slug( 'bar', $term );
     
    2325
    2426    public function test_nonunique_slug_in_different_taxonomy_should_be_unchanged() {
    25         $term1 = self::factory()->term->create( array(
    26             'taxonomy' => 'wptests_tax2',
    27             'name' => 'bar',
    28             'slug' => 'bar',
    29         ) );
     27        $term1 = self::factory()->term->create(
     28            array(
     29                'taxonomy' => 'wptests_tax2',
     30                'name'     => 'bar',
     31                'slug'     => 'bar',
     32            )
     33        );
    3034
    31         $term2 = self::factory()->term->create( array(
    32             'taxonomy' => 'wptests_tax1',
    33             'name' => 'foo',
    34             'slug' => 'foo',
    35         ) );
     35        $term2        = self::factory()->term->create(
     36            array(
     37                'taxonomy' => 'wptests_tax1',
     38                'name'     => 'foo',
     39                'slug'     => 'foo',
     40            )
     41        );
    3642        $term2_object = get_term( $term2, 'wptests_tax1' );
    3743
     
    4147
    4248    public function test_nonunique_slug_in_same_nonhierarchical_taxonomy_should_be_changed() {
    43         $term1 = self::factory()->term->create( array(
    44             'taxonomy' => 'wptests_tax1',
    45             'name' => 'bar',
    46             'slug' => 'bar',
    47         ) );
     49        $term1 = self::factory()->term->create(
     50            array(
     51                'taxonomy' => 'wptests_tax1',
     52                'name'     => 'bar',
     53                'slug'     => 'bar',
     54            )
     55        );
    4856
    49         $term2 = self::factory()->term->create( array(
    50             'taxonomy' => 'wptests_tax1',
    51             'name' => 'foo',
    52             'slug' => 'foo',
    53         ) );
     57        $term2        = self::factory()->term->create(
     58            array(
     59                'taxonomy' => 'wptests_tax1',
     60                'name'     => 'foo',
     61                'slug'     => 'foo',
     62            )
     63        );
    5464        $term2_object = get_term( $term2, 'wptests_tax1' );
    5565
     
    5969
    6070    public function test_nonunique_slug_in_same_hierarchical_taxonomy_with_same_parent_should_be_suffixed_with_parent_slug() {
    61         $parent = self::factory()->term->create( array(
    62             'taxonomy' => 'wptests_tax2',
    63             'slug' => 'parent-term',
    64         ) );
     71        $parent = self::factory()->term->create(
     72            array(
     73                'taxonomy' => 'wptests_tax2',
     74                'slug'     => 'parent-term',
     75            )
     76        );
    6577
    66         $term1 = self::factory()->term->create( array(
    67             'taxonomy' => 'wptests_tax2',
    68             'name' => 'bar',
    69             'slug' => 'bar',
    70             'parent' => $parent,
    71         ) );
     78        $term1 = self::factory()->term->create(
     79            array(
     80                'taxonomy' => 'wptests_tax2',
     81                'name'     => 'bar',
     82                'slug'     => 'bar',
     83                'parent'   => $parent,
     84            )
     85        );
    7286
    73         $term2 = self::factory()->term->create( array(
    74             'taxonomy' => 'wptests_tax2',
    75             'name' => 'foo',
    76             'slug' => 'foo',
    77             'parent' => $parent,
    78         ) );
     87        $term2        = self::factory()->term->create(
     88            array(
     89                'taxonomy' => 'wptests_tax2',
     90                'name'     => 'foo',
     91                'slug'     => 'foo',
     92                'parent'   => $parent,
     93            )
     94        );
    7995        $term2_object = get_term( $term2, 'wptests_tax2' );
    8096
     
    84100
    85101    public function test_nonunique_slug_in_same_hierarchical_taxonomy_at_different_level_of_hierarchy_should_be_suffixed_with_number() {
    86         $parent = self::factory()->term->create( array(
    87             'taxonomy' => 'wptests_tax2',
    88             'slug' => 'parent-term',
    89         ) );
     102        $parent = self::factory()->term->create(
     103            array(
     104                'taxonomy' => 'wptests_tax2',
     105                'slug'     => 'parent-term',
     106            )
     107        );
    90108
    91         $term1 = self::factory()->term->create( array(
    92             'taxonomy' => 'wptests_tax2',
    93             'name' => 'bar',
    94             'slug' => 'bar',
    95             'parent' => $parent,
    96         ) );
     109        $term1 = self::factory()->term->create(
     110            array(
     111                'taxonomy' => 'wptests_tax2',
     112                'name'     => 'bar',
     113                'slug'     => 'bar',
     114                'parent'   => $parent,
     115            )
     116        );
    97117
    98         $term2 = self::factory()->term->create( array(
    99             'taxonomy' => 'wptests_tax2',
    100             'name' => 'foo',
    101             'slug' => 'foo',
    102         ) );
     118        $term2        = self::factory()->term->create(
     119            array(
     120                'taxonomy' => 'wptests_tax2',
     121                'name'     => 'foo',
     122                'slug'     => 'foo',
     123            )
     124        );
    103125        $term2_object = get_term( $term2, 'wptests_tax2' );
    104126
Note: See TracChangeset for help on using the changeset viewer.