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/wpInsertTerm.php

    r40145 r42343  
    1212        // otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs
    1313        $term = 'seed_term';
    14         foreach(get_object_taxonomies('post') as $tax)
     14        foreach ( get_object_taxonomies( 'post' ) as $tax ) {
    1515            wp_insert_term( $term, $tax );
     16        }
    1617    }
    1718
     
    2223        // a new unused term
    2324        $term = 'term';
    24         $this->assertNull( term_exists($term) );
     25        $this->assertNull( term_exists( $term ) );
    2526
    2627        $initial_count = wp_count_terms( $taxonomy );
     
    3435
    3536        // make sure the term exists
    36         $this->assertTrue( term_exists($term) > 0 );
    37         $this->assertTrue( term_exists($t['term_id']) > 0 );
     37        $this->assertTrue( term_exists( $term ) > 0 );
     38        $this->assertTrue( term_exists( $t['term_id'] ) > 0 );
    3839
    3940        // now delete it
     
    4142        $this->assertTrue( wp_delete_term( $t['term_id'], $taxonomy ) );
    4243        remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 5 );
    43         $this->assertNull( term_exists($term) );
    44         $this->assertNull( term_exists($t['term_id']) );
     44        $this->assertNull( term_exists( $term ) );
     45        $this->assertNull( term_exists( $t['term_id'] ) );
    4546        $this->assertEquals( $initial_count, wp_count_terms( $taxonomy ) );
    4647    }
     
    7778
    7879    public function test_wp_insert_term_parent_does_not_exist() {
    79         $found = wp_insert_term( 'foo', 'post_tag', array(
    80             'parent' => 999999,
    81         ) );
     80        $found = wp_insert_term(
     81            'foo', 'post_tag', array(
     82                'parent' => 999999,
     83            )
     84        );
    8285
    8386        $this->assertWPError( $found );
     
    97100    public function test_wp_insert_term_unslash_description() {
    98101        register_taxonomy( 'wptests_tax', 'post' );
    99         $found = wp_insert_term( 'Quality', 'wptests_tax', array(
    100             'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy',
    101         ) );
     102        $found = wp_insert_term(
     103            'Quality', 'wptests_tax', array(
     104                'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy',
     105            )
     106        );
    102107
    103108        $term = get_term( $found['term_id'], 'wptests_tax' );
     
    109114    public function test_wp_insert_term_parent_string() {
    110115        register_taxonomy( 'wptests_tax', 'post' );
    111         $found = wp_insert_term( 'Quality', 'wptests_tax', array(
    112             'parent' => 'foo1',
    113         ) );
     116        $found = wp_insert_term(
     117            'Quality', 'wptests_tax', array(
     118                'parent' => 'foo1',
     119            )
     120        );
    114121
    115122        $term = get_term( $found['term_id'], 'wptests_tax' );
     
    122129    public function test_wp_insert_term_slug_empty_string() {
    123130        register_taxonomy( 'wptests_tax', 'post' );
    124         $found = wp_insert_term( 'Quality', 'wptests_tax', array(
    125             'slug' => '',
    126         ) );
     131        $found = wp_insert_term(
     132            'Quality', 'wptests_tax', array(
     133                'slug' => '',
     134            )
     135        );
    127136
    128137        $term = get_term( $found['term_id'], 'wptests_tax' );
     
    135144    public function test_wp_insert_term_slug_whitespace_string() {
    136145        register_taxonomy( 'wptests_tax', 'post' );
    137         $found = wp_insert_term( 'Quality', 'wptests_tax', array(
    138             'slug' => '  ',
    139         ) );
     146        $found = wp_insert_term(
     147            'Quality', 'wptests_tax', array(
     148                'slug' => '  ',
     149            )
     150        );
    140151
    141152        $term = get_term( $found['term_id'], 'wptests_tax' );
     
    147158    public function test_wp_insert_term_slug_0() {
    148159        register_taxonomy( 'wptests_tax', 'post' );
    149         $found = wp_insert_term( 'Quality', 'wptests_tax', array(
    150             'slug' => 0,
    151         ) );
     160        $found = wp_insert_term(
     161            'Quality', 'wptests_tax', array(
     162                'slug' => 0,
     163            )
     164        );
    152165
    153166        $term = get_term( $found['term_id'], 'wptests_tax' );
     
    166179
    167180        // Test existing term name with unique slug
    168         $term1 = self::factory()->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
     181        $term1 = self::factory()->tag->create(
     182            array(
     183                'name' => 'Bozo',
     184                'slug' => 'bozo1',
     185            )
     186        );
    169187        $this->assertNotWPError( $term1 );
    170188
     
    188206
    189207        // Test named terms with only special characters
    190         $term8 = self::factory()->tag->create( array( 'name' => '$' ) );
    191         $term9 = self::factory()->tag->create( array( 'name' => '$$' ) );
     208        $term8  = self::factory()->tag->create( array( 'name' => '$' ) );
     209        $term9  = self::factory()->tag->create( array( 'name' => '$$' ) );
    192210        $term10 = self::factory()->tag->create( array( 'name' => '$$$' ) );
    193211        $term11 = self::factory()->tag->create( array( 'name' => '$$$$' ) );
     
    204222        $term14 = self::factory()->tag->create( array( 'name' => 'A' ) );
    205223        $this->assertWPError( $term14 );
    206         $term15 = self::factory()->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
     224        $term15 = self::factory()->tag->create(
     225            array(
     226                'name' => 'A+',
     227                'slug' => 'a',
     228            )
     229        );
    207230        $this->assertNotWPError( $term15 );
    208231        $term16 = self::factory()->tag->create( array( 'name' => 'A+' ) );
     
    210233        $term17 = self::factory()->tag->create( array( 'name' => 'A++' ) );
    211234        $this->assertNotWPError( $term17 );
    212         $term18 = self::factory()->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );
     235        $term18 = self::factory()->tag->create(
     236            array(
     237                'name' => 'A-',
     238                'slug' => 'a',
     239            )
     240        );
    213241        $this->assertNotWPError( $term18 );
    214242        $term19 = self::factory()->tag->create( array( 'name' => 'A-' ) );
     
    223251    public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_non_hierarchical_taxonomy() {
    224252        register_taxonomy( 'wptests_tax', 'post' );
    225         $t1 = self::factory()->term->create( array(
    226             'name' => 'Foo',
    227             'slug' => 'foo',
    228             'taxonomy' => 'wptests_tax',
    229         ) );
    230 
    231         $t2 = wp_insert_term( 'Foo', 'wptests_tax', array(
    232             'slug' => 'foo',
    233         ) );
     253        $t1 = self::factory()->term->create(
     254            array(
     255                'name'     => 'Foo',
     256                'slug'     => 'foo',
     257                'taxonomy' => 'wptests_tax',
     258            )
     259        );
     260
     261        $t2 = wp_insert_term(
     262            'Foo', 'wptests_tax', array(
     263                'slug' => 'foo',
     264            )
     265        );
    234266
    235267        $this->assertWPError( $t2 );
     
    242274    public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_in_non_hierarchical_taxonomy() {
    243275        register_taxonomy( 'wptests_tax', 'post' );
    244         $t1 = self::factory()->term->create( array(
    245             'name' => 'Foo',
    246             'slug' => 'foo',
    247             'taxonomy' => 'wptests_tax',
    248         ) );
    249 
    250         $t2 = self::factory()->term->create( array(
    251             'name' => 'Bar',
    252             'slug' => 'bar',
    253             'taxonomy' => 'wptests_tax',
    254         ) );
    255 
    256         $t3 = wp_insert_term( 'Foo', 'wptests_tax', array(
    257             'slug' => 'bar',
    258         ) );
     276        $t1 = self::factory()->term->create(
     277            array(
     278                'name'     => 'Foo',
     279                'slug'     => 'foo',
     280                'taxonomy' => 'wptests_tax',
     281            )
     282        );
     283
     284        $t2 = self::factory()->term->create(
     285            array(
     286                'name'     => 'Bar',
     287                'slug'     => 'bar',
     288                'taxonomy' => 'wptests_tax',
     289            )
     290        );
     291
     292        $t3 = wp_insert_term(
     293            'Foo', 'wptests_tax', array(
     294                'slug' => 'bar',
     295            )
     296        );
    259297
    260298        $this->assertWPError( $t3 );
     
    267305    public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_non_hierarchical_taxonomy() {
    268306        register_taxonomy( 'wptests_tax', 'post' );
    269         $t1 = self::factory()->term->create( array(
    270             'name' => 'Foo',
    271             'slug' => 'foo',
    272             'taxonomy' => 'wptests_tax',
    273         ) );
    274 
    275         $t2 = wp_insert_term( 'Foo', 'wptests_tax', array(
    276             'slug' => 'foo-unique',
    277         ) );
     307        $t1 = self::factory()->term->create(
     308            array(
     309                'name'     => 'Foo',
     310                'slug'     => 'foo',
     311                'taxonomy' => 'wptests_tax',
     312            )
     313        );
     314
     315        $t2 = wp_insert_term(
     316            'Foo', 'wptests_tax', array(
     317                'slug' => 'foo-unique',
     318            )
     319        );
    278320
    279321        $this->assertNotWPError( $t2 );
     
    289331    public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_non_hierarchical_taxonomy() {
    290332        register_taxonomy( 'wptests_tax', 'post' );
    291         $t1 = self::factory()->term->create( array(
    292             'name' => 'Foo',
    293             'slug' => 'foo',
    294             'taxonomy' => 'wptests_tax',
    295         ) );
     333        $t1 = self::factory()->term->create(
     334            array(
     335                'name'     => 'Foo',
     336                'slug'     => 'foo',
     337                'taxonomy' => 'wptests_tax',
     338            )
     339        );
    296340
    297341        $t2 = wp_insert_term( 'Foo', 'wptests_tax' );
     
    306350    public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_hierarchical_taxonomy() {
    307351        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    308         $t1 = self::factory()->term->create( array(
    309             'name' => 'Foo',
    310             'slug' => 'foo',
    311             'taxonomy' => 'wptests_tax',
    312         ) );
    313 
    314         $t2 = wp_insert_term( 'Foo', 'wptests_tax', array(
    315             'slug' => 'foo',
    316         ) );
     352        $t1 = self::factory()->term->create(
     353            array(
     354                'name'     => 'Foo',
     355                'slug'     => 'foo',
     356                'taxonomy' => 'wptests_tax',
     357            )
     358        );
     359
     360        $t2 = wp_insert_term(
     361            'Foo', 'wptests_tax', array(
     362                'slug' => 'foo',
     363            )
     364        );
    317365
    318366        $this->assertWPError( $t2 );
     
    325373    public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_at_same_hierarchy_level_in_hierarchical_taxonomy() {
    326374        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    327         $t1 = self::factory()->term->create( array(
    328             'name' => 'Foo',
    329             'slug' => 'foo',
    330             'taxonomy' => 'wptests_tax',
    331         ) );
    332 
    333         $t2 = self::factory()->term->create( array(
    334             'name' => 'Bar',
    335             'slug' => 'bar',
    336             'taxonomy' => 'wptests_tax',
    337         ) );
    338 
    339         $t3 = wp_insert_term( 'Foo', 'wptests_tax', array(
    340             'slug' => 'bar',
    341         ) );
     375        $t1 = self::factory()->term->create(
     376            array(
     377                'name'     => 'Foo',
     378                'slug'     => 'foo',
     379                'taxonomy' => 'wptests_tax',
     380            )
     381        );
     382
     383        $t2 = self::factory()->term->create(
     384            array(
     385                'name'     => 'Bar',
     386                'slug'     => 'bar',
     387                'taxonomy' => 'wptests_tax',
     388            )
     389        );
     390
     391        $t3 = wp_insert_term(
     392            'Foo', 'wptests_tax', array(
     393                'slug' => 'bar',
     394            )
     395        );
    342396
    343397        $this->assertWPError( $t3 );
     
    350404    public function test_wp_insert_term_should_allow_duplicate_names_when_slug_is_a_duplicate_of_a_term_at_different_hierarchy_level_in_hierarchical_taxonomy() {
    351405        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    352         $t1 = self::factory()->term->create( array(
    353             'name' => 'Foo',
    354             'slug' => 'foo',
    355             'taxonomy' => 'wptests_tax',
    356         ) );
     406        $t1 = self::factory()->term->create(
     407            array(
     408                'name'     => 'Foo',
     409                'slug'     => 'foo',
     410                'taxonomy' => 'wptests_tax',
     411            )
     412        );
    357413
    358414        $t2 = self::factory()->term->create();
    359415
    360         $t3 = self::factory()->term->create( array(
    361             'name' => 'Bar',
    362             'slug' => 'bar',
    363             'parent' => $t2,
    364             'taxonomy' => 'wptests_tax',
    365         ) );
    366 
    367         $t4 = wp_insert_term( 'Foo', 'wptests_tax', array(
    368             'slug' => 'bar',
    369         ) );
     416        $t3 = self::factory()->term->create(
     417            array(
     418                'name'     => 'Bar',
     419                'slug'     => 'bar',
     420                'parent'   => $t2,
     421                'taxonomy' => 'wptests_tax',
     422            )
     423        );
     424
     425        $t4 = wp_insert_term(
     426            'Foo', 'wptests_tax', array(
     427                'slug' => 'bar',
     428            )
     429        );
    370430
    371431        $this->assertNotWPError( $t4 );
     
    382442    public function test_duplicate_name_check_should_fail_when_no_slug_is_provided_even_when_slugs_would_not_clash() {
    383443        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    384         $t1 = self::factory()->term->create( array(
    385             'name' => 'Foo',
    386             'slug' => 'foo-no-conflict',
    387             'taxonomy' => 'wptests_tax',
    388         ) );
     444        $t1 = self::factory()->term->create(
     445            array(
     446                'name'     => 'Foo',
     447                'slug'     => 'foo-no-conflict',
     448                'taxonomy' => 'wptests_tax',
     449            )
     450        );
    389451
    390452        $error = wp_insert_term( 'Foo', 'wptests_tax' );
     
    400462    public function test_error_should_reference_correct_term_when_rejected_as_duplicate() {
    401463        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    402         $t1 = self::factory()->term->create( array(
    403             'name' => 'Foo',
    404             'slug' => 'foo',
    405             'taxonomy' => 'wptests_tax',
    406         ) );
    407 
    408         $t2 = self::factory()->term->create( array(
    409             'name' => 'Bar',
    410             'slug' => 'bar',
    411             'taxonomy' => 'wptests_tax',
    412         ) );
    413 
    414         $t1_child = wp_insert_term( 'Child', 'wptests_tax', array(
    415             'parent' => $t1,
    416         ) );
    417 
    418         $t2_child = wp_insert_term( 'Child', 'wptests_tax', array(
    419             'parent' => $t2,
    420         ) );
    421 
    422         $error = wp_insert_term( 'Child', 'wptests_tax', array(
    423             'parent' => $t2,
    424         ) );
     464        $t1 = self::factory()->term->create(
     465            array(
     466                'name'     => 'Foo',
     467                'slug'     => 'foo',
     468                'taxonomy' => 'wptests_tax',
     469            )
     470        );
     471
     472        $t2 = self::factory()->term->create(
     473            array(
     474                'name'     => 'Bar',
     475                'slug'     => 'bar',
     476                'taxonomy' => 'wptests_tax',
     477            )
     478        );
     479
     480        $t1_child = wp_insert_term(
     481            'Child', 'wptests_tax', array(
     482                'parent' => $t1,
     483            )
     484        );
     485
     486        $t2_child = wp_insert_term(
     487            'Child', 'wptests_tax', array(
     488                'parent' => $t2,
     489            )
     490        );
     491
     492        $error = wp_insert_term(
     493            'Child', 'wptests_tax', array(
     494                'parent' => $t2,
     495            )
     496        );
    425497
    426498        $this->assertWPError( $error );
     
    434506    public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_hierarchical_taxonomy() {
    435507        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    436         $t1 = self::factory()->term->create( array(
    437             'name' => 'Foo',
    438             'slug' => 'foo',
    439             'taxonomy' => 'wptests_tax',
    440         ) );
    441 
    442         $t2 = wp_insert_term( 'Foo', 'wptests_tax', array(
    443             'slug' => 'foo-unique',
    444         ) );
     508        $t1 = self::factory()->term->create(
     509            array(
     510                'name'     => 'Foo',
     511                'slug'     => 'foo',
     512                'taxonomy' => 'wptests_tax',
     513            )
     514        );
     515
     516        $t2 = wp_insert_term(
     517            'Foo', 'wptests_tax', array(
     518                'slug' => 'foo-unique',
     519            )
     520        );
    445521
    446522        $this->assertNotWPError( $t2 );
     
    456532    public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_hierarchical_taxonomy() {
    457533        register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    458         $t1 = self::factory()->term->create( array(
    459             'name' => 'Foo',
    460             'slug' => 'foo',
    461             'taxonomy' => 'wptests_tax',
    462         ) );
     534        $t1 = self::factory()->term->create(
     535            array(
     536                'name'     => 'Foo',
     537                'slug'     => 'foo',
     538                'taxonomy' => 'wptests_tax',
     539            )
     540        );
    463541
    464542        $t2 = wp_insert_term( 'Foo', 'wptests_tax' );
     
    472550    public function test_wp_insert_term_duplicate_slug_same_taxonomy() {
    473551        register_taxonomy( 'wptests_tax', 'post' );
    474         $t = self::factory()->term->create( array(
    475             'name' => 'Foo',
    476             'slug' => 'foo',
    477             'taxonomy' => 'wptests_tax',
    478         ) );
     552        $t = self::factory()->term->create(
     553            array(
     554                'name'     => 'Foo',
     555                'slug'     => 'foo',
     556                'taxonomy' => 'wptests_tax',
     557            )
     558        );
    479559
    480560        $term = get_term( $t, 'wptests_tax' );
    481561
    482         $created = wp_insert_term( 'Foo 2', 'wptests_tax', array(
    483             'slug' => 'foo',
    484         ) );
     562        $created = wp_insert_term(
     563            'Foo 2', 'wptests_tax', array(
     564                'slug' => 'foo',
     565            )
     566        );
    485567
    486568        $created_term = get_term( $created['term_id'], 'wptests_tax' );
     
    496578        register_taxonomy( 'wptests_tax', 'post' );
    497579        register_taxonomy( 'wptests_tax_2', 'post' );
    498         $t = self::factory()->term->create( array(
    499             'name' => 'Foo',
    500             'slug' => 'foo',
    501             'taxonomy' => 'wptests_tax',
    502         ) );
     580        $t = self::factory()->term->create(
     581            array(
     582                'name'     => 'Foo',
     583                'slug'     => 'foo',
     584                'taxonomy' => 'wptests_tax',
     585            )
     586        );
    503587
    504588        $term = get_term( $t, 'wptests_tax' );
    505589
    506         $created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array(
    507             'slug' => 'foo',
    508         ) );
     590        $created = wp_insert_term(
     591            'Foo 2', 'wptests_tax_2', array(
     592                'slug' => 'foo',
     593            )
     594        );
    509595
    510596        $this->assertNotWPError( $created );
     
    526612        register_taxonomy( 'wptests_tax', 'post' );
    527613        register_taxonomy( 'wptests_tax_2', 'post' );
    528         $t = self::factory()->term->create( array(
    529             'name' => 'Foo',
    530             'slug' => 'foo',
    531             'taxonomy' => 'wptests_tax',
    532         ) );
     614        $t = self::factory()->term->create(
     615            array(
     616                'name'     => 'Foo',
     617                'slug'     => 'foo',
     618                'taxonomy' => 'wptests_tax',
     619            )
     620        );
    533621
    534622        $term = get_term( $t, 'wptests_tax' );
    535623
    536         $created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array(
    537             'slug' => 'foo',
    538         ) );
     624        $created = wp_insert_term(
     625            'Foo 2', 'wptests_tax_2', array(
     626                'slug' => 'foo',
     627            )
     628        );
    539629
    540630        $this->assertNotWPError( $created );
     
    554644    public function test_wp_insert_term_alias_of_no_term_group() {
    555645        register_taxonomy( 'wptests_tax', 'post' );
    556         $t1 = self::factory()->term->create( array(
    557             'taxonomy' => 'wptests_tax',
    558         ) );
     646        $t1     = self::factory()->term->create(
     647            array(
     648                'taxonomy' => 'wptests_tax',
     649            )
     650        );
    559651        $term_1 = get_term( $t1, 'wptests_tax' );
    560652
    561         $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
    562             'alias_of' => $term_1->slug,
    563         ) );
    564         $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
     653        $created_term_ids = wp_insert_term(
     654            'Foo', 'wptests_tax', array(
     655                'alias_of' => $term_1->slug,
     656            )
     657        );
     658        $created_term     = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    565659
    566660        $updated_term_1 = get_term( $term_1->term_id, 'wptests_tax' );
     
    576670    public function test_wp_insert_term_alias_of_existing_term_group() {
    577671        register_taxonomy( 'wptests_tax', 'post' );
    578         $t1 = self::factory()->term->create( array(
    579             'taxonomy' => 'wptests_tax',
    580         ) );
     672        $t1     = self::factory()->term->create(
     673            array(
     674                'taxonomy' => 'wptests_tax',
     675            )
     676        );
    581677        $term_1 = get_term( $t1, 'wptests_tax' );
    582678
    583         $t2 = self::factory()->term->create( array(
    584             'taxonomy' => 'wptests_tax',
    585             'alias_of' => $term_1->slug,
    586         ) );
     679        $t2     = self::factory()->term->create(
     680            array(
     681                'taxonomy' => 'wptests_tax',
     682                'alias_of' => $term_1->slug,
     683            )
     684        );
    587685        $term_2 = get_term( $t2, 'wptests_tax' );
    588686
    589         $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
    590             'alias_of' => $term_2->slug,
    591         ) );
    592         $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
     687        $created_term_ids = wp_insert_term(
     688            'Foo', 'wptests_tax', array(
     689                'alias_of' => $term_2->slug,
     690            )
     691        );
     692        $created_term     = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    593693        _unregister_taxonomy( 'wptests_tax' );
    594694
     
    599699    public function test_wp_insert_term_alias_of_nonexistent_term() {
    600700        register_taxonomy( 'wptests_tax', 'post' );
    601         $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
    602             'alias_of' => 'foo',
    603         ) );
    604         $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
     701        $created_term_ids = wp_insert_term(
     702            'Foo', 'wptests_tax', array(
     703                'alias_of' => 'foo',
     704            )
     705        );
     706        $created_term     = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    605707        _unregister_taxonomy( 'wptests_tax' );
    606708
     
    625727        $found = wp_insert_term( 'foo', 'wptests_tax' );
    626728
    627         $term_by_id = get_term( $found['term_id'], 'wptests_tax' );
     729        $term_by_id   = get_term( $found['term_id'], 'wptests_tax' );
    628730        $term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' );
    629731        $term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' );
     
    640742
    641743    public function test_wp_insert_term_should_clean_term_cache() {
    642         register_taxonomy( 'wptests_tax', 'post', array(
    643             'hierarchical' => true,
    644         ) );
    645 
    646         $t = self::factory()->term->create( array(
    647             'taxonomy' => 'wptests_tax',
    648         ) );
     744        register_taxonomy(
     745            'wptests_tax', 'post', array(
     746                'hierarchical' => true,
     747            )
     748        );
     749
     750        $t = self::factory()->term->create(
     751            array(
     752                'taxonomy' => 'wptests_tax',
     753            )
     754        );
    649755
    650756        /**
     
    657763        wp_cache_set( 'get', array( 1, 2, 3 ), 'wptests_tax' );
    658764
    659         $found = wp_insert_term( 'foo', 'wptests_tax', array(
    660             'parent' => $t,
    661         ) );
     765        $found = wp_insert_term(
     766            'foo', 'wptests_tax', array(
     767                'parent' => $t,
     768            )
     769        );
    662770        _unregister_taxonomy( 'wptests_tax' );
    663771
     
    676784        register_taxonomy( 'wptests_tax', 'post' );
    677785
    678         $t1 = self::factory()->term->create( array(
    679             'name' => 'Foó',
    680             'taxonomy' => 'wptests_tax',
    681         ) );
    682         $t2 = self::factory()->term->create( array(
    683             'name' => 'Foo',
    684             'taxonomy' => 'wptests_tax',
    685         ) );
     786        $t1 = self::factory()->term->create(
     787            array(
     788                'name'     => 'Foó',
     789                'taxonomy' => 'wptests_tax',
     790            )
     791        );
     792        $t2 = self::factory()->term->create(
     793            array(
     794                'name'     => 'Foo',
     795                'taxonomy' => 'wptests_tax',
     796            )
     797        );
    686798
    687799        $this->assertInternalType( 'int', $t1 );
     
    701813        register_taxonomy( 'wptests_tax', 'post' );
    702814
    703         $t1 = self::factory()->term->create( array(
    704             'name' => 'Foo#bar',
    705             'taxonomy' => 'wptests_tax',
    706         ) );
     815        $t1 = self::factory()->term->create(
     816            array(
     817                'name'     => 'Foo#bar',
     818                'taxonomy' => 'wptests_tax',
     819            )
     820        );
    707821
    708822        $created = wp_insert_term( 'Foo$bar', 'wptests_tax' );
     
    722836        register_taxonomy( 'wptests_tax', 'post' );
    723837
    724         $term = wp_insert_term( 'foo', 'wptests_tax', array(
    725             'description' => null
    726         ) );
     838        $term = wp_insert_term(
     839            'foo', 'wptests_tax', array(
     840                'description' => null,
     841            )
     842        );
    727843
    728844        $term_object = get_term( $term['term_id'] );
     
    732848    }
    733849
    734     /** Helpers **********************************************************/
     850    /** Helpers */
    735851
    736852    public function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term, $object_ids ) {
Note: See TracChangeset for help on using the changeset viewer.