Make WordPress Core

Ticket #35227: 35227.diff

File 35227.diff, 39.5 KB (added by swissspidy, 10 years ago)
  • src/wp-includes/class-wp-rewrite.php

    diff --git src/wp-includes/class-wp-rewrite.php src/wp-includes/class-wp-rewrite.php
    index 035bbc3..467f823 100644
    class WP_Rewrite { 
    842842        }
    843843
    844844        /**
     845         * Adds or updates existing rewrite tags (e.g. %postname%).
     846         *
     847         * If the tag already exists, replace the existing pattern and query for
     848         * that tag, otherwise add the new tag.
     849         *
     850         * @since 4.5.0
     851         * @access public
     852         *
     853         * @see WP_Rewrite::$rewritecode
     854         * @see WP_Rewrite::$rewritereplace
     855         * @see WP_Rewrite::$queryreplace
     856         *
     857         * @param string $tag Name of the rewrite tag.
     858         */
     859        public function remove_rewrite_tag( $tag ) {
     860                $position = array_search( $tag, $this->rewritecode );
     861                if ( false !== $position && null !== $position ) {
     862                        unset( $this->rewritecode[ $position ] );
     863                        unset( $this->rewritereplace[ $position ] );
     864                        unset( $this->queryreplace[ $position ] );
     865                }
     866        }
     867
     868        /**
    845869         * Generates rewrite rules from a permalink structure.
    846870         *
    847871         * The main WP_Rewrite function for building the rewrite rule list. The
  • src/wp-includes/rewrite.php

    diff --git src/wp-includes/rewrite.php src/wp-includes/rewrite.php
    index 7f3b2ed..826ced2 100644
    function add_rewrite_tag( $tag, $regex, $query = '' ) { 
    173173}
    174174
    175175/**
     176 * Removes an existing rewrite tag (like %postname%).
     177 *
     178 * @since 4.5.0
     179 *
     180 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
     181 * @global WP         $wp         Current WordPress environment instance.
     182 *
     183 * @param string $tag Name of the rewrite tag.
     184 */
     185function remove_rewrite_tag( $tag ) {
     186        global $wp_rewrite;
     187        $wp_rewrite->remove_rewrite_tag( $tag );
     188}
     189
     190/**
    176191 * Add permalink structure.
    177192 *
    178193 * @since 3.0.0
  • src/wp-includes/taxonomy.php

    diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
    index 8cbef3c..02ac213 100644
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    473473}
    474474
    475475/**
     476 * Unregister a taxonomy.
     477 *
     478 * @since 4.5.0
     479 *
     480 * @global WP_Rewrite $wp_rewrite    WordPress rewrite component.
     481 * @global WP         $wp            Current WordPress environment instance.
     482 * @global array      $wp_taxonomies List of taxonomies.
     483 *
     484 * @param string $taxonomy Taxonomy name.
     485 * @return bool True on success, false on failure.
     486 */
     487function unregister_taxonomy( $taxonomy ) {
     488        if ( ! taxonomy_exists( $taxonomy ) ) {
     489                return false;
     490        }
     491
     492        $taxonomy_args = get_taxonomy( $taxonomy );
     493
     494        // Do not allow unregistering internal taxonomies.
     495        if ( $taxonomy_args->_builtin ) {
     496                return false;
     497        }
     498
     499        global $wp_taxonomies, $wp_rewrite, $wp;
     500
     501        // Remove query vars.
     502        if ( false !== $taxonomy_args->query_var ) {
     503                $wp->public_query_vars = array_diff( $wp->public_query_vars, array( $taxonomy_args->query_var ) );
     504        }
     505
     506        // Remove any rewrite rules, permastructs, and rules.
     507        if ( false !== $taxonomy_args->rewrite ) {
     508                remove_rewrite_tag( "%$taxonomy%" );
     509                unset( $wp_rewrite->extra_permastructs[ $taxonomy ] );
     510        }
     511
     512        // Unregister callback handling for metabox.
     513        remove_all_actions( 'wp_ajax_add-' . $taxonomy );
     514
     515        // Remove the taxonomy.
     516        unset( $wp_taxonomies[ $taxonomy ] );
     517
     518        /**
     519         * Fires after a taxonomy is unregistered.
     520         *
     521         * @since 4.5.0
     522         *
     523         * @param string $taxonomy Taxonomy name.
     524         */
     525        do_action( 'unregistered_taxonomy', $taxonomy );
     526
     527        return true;
     528}
     529
     530/**
    476531 * Builds an object with all taxonomy labels out of a taxonomy object
    477532 *
    478533 * Accepted keys of the label array in the taxonomy object:
  • tests/phpunit/includes/testcase.php

    diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
    index a468deb..f9a98da 100644
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    171171         */
    172172        protected function reset_taxonomies() {
    173173                foreach ( get_taxonomies() as $tax ) {
    174                         _unregister_taxonomy( $tax );
     174                        unregister_taxonomy( $tax );
    175175                }
    176176                create_initial_taxonomies();
    177177        }
  • tests/phpunit/includes/utils.php

    diff --git tests/phpunit/includes/utils.php tests/phpunit/includes/utils.php
    index 0a6dfc1..47b6885 100644
    function _unregister_post_type( $cpt_name ) { 
    333333        }
    334334}
    335335
    336 function _unregister_taxonomy( $taxonomy_name ) {
    337         unset( $GLOBALS['wp_taxonomies'][$taxonomy_name] );
    338 }
    339 
    340336/**
    341337 * Unregister a post status.
    342338 *
    class wpdb_exposed_methods_for_testing extends wpdb { 
    398394 */
    399395function benchmark_pcre_backtracking( $pattern, $subject, $strategy ) {
    400396        $saved_config = ini_get( 'pcre.backtrack_limit' );
    401        
     397
    402398        // Attempt to prevent PHP crashes.  Adjust these lower when needed.
    403399        if ( version_compare( phpversion(), '5.4.8', '>' ) ) {
    404400                $limit = 1000000;
    function benchmark_pcre_backtracking( $pattern, $subject, $strategy ) { 
    410406        for( $i = 4; $i <= $limit; $i *= 2 ) {
    411407
    412408                ini_set( 'pcre.backtrack_limit', $i );
    413                
     409
    414410                switch( $strategy ) {
    415411                case 'split':
    416412                        preg_split( $pattern, $subject );
  • tests/phpunit/tests/category.php

    diff --git tests/phpunit/tests/category.php tests/phpunit/tests/category.php
    index 913f4dc..730f5d5 100644
     
    1010class Tests_Category extends WP_UnitTestCase {
    1111
    1212        function tearDown() {
    13                 _unregister_taxonomy( 'test_tax_cat' );
     13                unregister_taxonomy( 'test_tax_cat' );
    1414                parent::tearDown();
    1515        }
    1616
  • tests/phpunit/tests/query/dateQuery.php

    diff --git tests/phpunit/tests/query/dateQuery.php tests/phpunit/tests/query/dateQuery.php
    index f40302d..7aadc8d 100644
    class Tests_Query_DateQuery extends WP_UnitTestCase { 
    848848                        ),
    849849                ) );
    850850
    851                 _unregister_taxonomy( 'foo' );
     851                unregister_taxonomy( 'foo' );
    852852
    853853                $this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
    854854        }
  • tests/phpunit/tests/query/isTerm.php

    diff --git tests/phpunit/tests/query/isTerm.php tests/phpunit/tests/query/isTerm.php
    index c9a4160..294b33d 100644
    class Tests_Query_IsTerm extends WP_UnitTestCase { 
    5858        function tearDown() {
    5959                global $wp_rewrite;
    6060
    61                 _unregister_taxonomy( 'testtax' );
     61                unregister_taxonomy( 'testtax' );
    6262
    6363                $wp_rewrite->init();
    6464
  • tests/phpunit/tests/query/taxQuery.php

    diff --git tests/phpunit/tests/query/taxQuery.php tests/phpunit/tests/query/taxQuery.php
    index 8248b19..6265afa 100644
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    691691                        ),
    692692                ) );
    693693
    694                 _unregister_taxonomy( 'foo' );
    695                 _unregister_taxonomy( 'bar' );
     694                unregister_taxonomy( 'foo' );
     695                unregister_taxonomy( 'bar' );
    696696
    697697                $this->assertEqualSets( array( $p1, $p2 ), $q->posts );
    698698        }
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    755755                        ),
    756756                ) );
    757757
    758                 _unregister_taxonomy( 'foo' );
    759                 _unregister_taxonomy( 'bar' );
     758                unregister_taxonomy( 'foo' );
     759                unregister_taxonomy( 'bar' );
    760760
    761761                $this->assertEqualSets( array( $p1, $p2 ), $q->posts );
    762762        }
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    828828                        ),
    829829                ) );
    830830
    831                 _unregister_taxonomy( 'foo' );
    832                 _unregister_taxonomy( 'bar' );
     831                unregister_taxonomy( 'foo' );
     832                unregister_taxonomy( 'bar' );
    833833
    834834                $this->assertEqualSets( array( $p1, $p2, $p3 ), $q->posts );
    835835        }
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    11851185
    11861186                $this->assertSame( 'foo', $q->get( 'taxonomy' ) );
    11871187
    1188                 _unregister_taxonomy( 'foo' );
     1188                unregister_taxonomy( 'foo' );
    11891189        }
    11901190
    11911191        public function test_populate_taxonomy_query_var_from_tax_query_taxonomy_already_set() {
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    12071207
    12081208                $this->assertSame( 'bar', $q->get( 'taxonomy' ) );
    12091209
    1210                 _unregister_taxonomy( 'foo' );
    1211                 _unregister_taxonomy( 'foo1' );
     1210                unregister_taxonomy( 'foo' );
     1211                unregister_taxonomy( 'foo1' );
    12121212        }
    12131213
    12141214        public function test_populate_term_query_var_from_tax_query() {
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    12301230
    12311231                $this->assertSame( 'bar', $q->get( 'term' ) );
    12321232
    1233                 _unregister_taxonomy( 'foo' );
     1233                unregister_taxonomy( 'foo' );
    12341234        }
    12351235
    12361236        public function test_populate_term_id_query_var_from_tax_query() {
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    12521252
    12531253                $this->assertEquals( $t, $q->get( 'term_id' ) );
    12541254
    1255                 _unregister_taxonomy( 'foo' );
     1255                unregister_taxonomy( 'foo' );
    12561256        }
    12571257
    12581258        /**
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    12931293                $this->assertEquals( $c, $q->get( 'cat' ) );
    12941294                $this->assertEquals( 'bar', $q->get( 'category_name' ) );
    12951295
    1296                 _unregister_taxonomy( 'foo' );
     1296                unregister_taxonomy( 'foo' );
    12971297        }
    12981298
    12991299        /**
    class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    13331333
    13341334                $this->assertEquals( $tag, $q->get( 'tag_id' ) );
    13351335
    1336                 _unregister_taxonomy( 'foo' );
     1336                unregister_taxonomy( 'foo' );
    13371337        }
    13381338}
  • tests/phpunit/tests/taxonomy.php

    diff --git tests/phpunit/tests/taxonomy.php tests/phpunit/tests/taxonomy.php
    index 2063bbe..f4b68bc 100644
    class Tests_Taxonomy extends WP_UnitTestCase { 
    235235                $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );
    236236
    237237                unset($GLOBALS['wp_taxonomies'][$tax]);
    238                 _unregister_post_type( $post_type );
     238                unregister_post_type( $post_type );
    239239
    240240        }
    241241
    class Tests_Taxonomy extends WP_UnitTestCase { 
    351351                ) );
    352352
    353353                $this->assertSame( array(), get_ancestors( $t, 'wptests_tax' ) );
    354                 _unregister_taxonomy( 'wptests_tax' );
     354                unregister_taxonomy( 'wptests_tax' );
    355355        }
    356356
    357357        public function test_get_ancestors_taxonomy() {
    class Tests_Taxonomy extends WP_UnitTestCase { 
    375375                ) );
    376376
    377377                $this->assertEqualSets( array( $t2, $t1 ), get_ancestors( $t3, 'wptests_tax' ) );
    378                 _unregister_taxonomy( 'wptests_tax' );
     378                unregister_taxonomy( 'wptests_tax' );
    379379        }
    380380
    381381        public function test_get_ancestors_post_type_non_hierarchical() {
    class Tests_Taxonomy extends WP_UnitTestCase { 
    408408                ) );
    409409
    410410                $this->assertEqualSets( array( $p2, $p1 ), get_ancestors( $p3, 'wptests_pt' ) );
    411                 _unregister_post_type( 'wptests_pt' );
     411                unregister_post_type( 'wptests_pt' );
    412412        }
    413413
    414414        /**
    class Tests_Taxonomy extends WP_UnitTestCase { 
    440440                $this->assertEqualSets( array( $p1 ), get_ancestors( $p2, 'wptests_conflict', 'post_type' ) );
    441441                $this->assertEqualSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict', 'taxonomy' ) );
    442442                $this->assertEqualSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict' ) );
    443                 _unregister_post_type( 'wptests_pt' );
     443                unregister_post_type( 'wptests_pt' );
    444444        }
    445445
    446446        /**
    class Tests_Taxonomy extends WP_UnitTestCase { 
    517517
    518518                $this->assertFalse( is_tax( 'wptests_tax' ) );
    519519        }
     520
     521        /**
     522         * @ticket 35227
     523         */
     524        public function test_unregister_taxonomy() {
     525                register_taxonomy( 'foo', 'post' );
     526                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     527        }
     528
     529        /**
     530         * @ticket 35227
     531         */
     532        public function test_unregister_taxonomy_unknown_taxonomy() {
     533                $this->assertFalse( unregister_taxonomy( 'foo' ) );
     534        }
     535
     536        /**
     537         * @ticket 35227
     538         */
     539        public function test_unregister_taxonomy_twice() {
     540                register_taxonomy( 'foo', 'post' );
     541                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     542                $this->assertFalse( unregister_taxonomy( 'foo' ) );
     543        }
     544
     545        /**
     546         * @ticket 35227
     547         */
     548        public function test_unregister_taxonomy_disallow_builtin_taxonomy() {
     549                $this->assertFalse( unregister_taxonomy( 'post_tag' ) );
     550                $this->assertFalse( unregister_taxonomy( 'category' ) );
     551        }
     552
     553        /**
     554         * @ticket 35227
     555         */
     556        public function test_unregister_taxonomy_removes_query_vars() {
     557                global $wp;
     558
     559                register_taxonomy( 'foo', 'post', array( 'query_var' => 'bar' ) );
     560
     561                $this->assertInternalType( 'int', array_search( 'bar', $wp->public_query_vars ) );
     562                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     563                $this->assertFalse( array_search( 'bar', $wp->public_query_vars ) );
     564        }
     565
     566        /**
     567         * @ticket 35227
     568         */
     569        public function test_unregister_taxonomy_removes_rewrite_rules() {
     570                $this->set_permalink_structure( '/%postname%' );
     571
     572                global $wp_rewrite;
     573
     574                register_taxonomy( 'foo', 'post', array( 'query_var' => 'bar' ) );
     575
     576                $count_before = count( $wp_rewrite->rewritereplace );
     577
     578                $this->assertInternalType( 'int', array_search( '%foo%', $wp_rewrite->rewritecode ) );
     579                $this->assertInternalType( 'int', array_search( 'bar=', $wp_rewrite->queryreplace ) );
     580                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     581                $this->assertFalse( array_search( '%foo%', $wp_rewrite->rewritecode ) );
     582                $this->assertFalse( array_search( 'bar=', $wp_rewrite->queryreplace ) );
     583                $this->assertSame( --$count_before, count( $wp_rewrite->rewritereplace ) ); // Array was reduced by one value.
     584        }
     585
     586        /**
     587         * @ticket 35227
     588         */
     589        public function test_unregister_taxonomy_removes_taxonomy_from_global() {
     590                global $wp_taxonomies;
     591
     592                register_taxonomy( 'foo', 'post' );
     593
     594                $this->assertInternalType( 'object', $wp_taxonomies['foo'] );
     595                $this->assertInternalType( 'object', get_taxonomy( 'foo' ) );
     596
     597                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     598
     599                $this->assertFalse( isset( $wp_taxonomies['foo'] ) );
     600                $this->assertFalse( get_taxonomy( 'foo' ) );
     601        }
     602
     603        /**
     604         * @ticket 35227
     605         */
     606        public function test_unregister_taxonomy_removes_meta_box_callback() {
     607                global $wp_filter;
     608
     609                register_taxonomy( 'foo', 'post' );
     610
     611                $this->assertSame( 1, count( $wp_filter['wp_ajax_add-foo'] ) );
     612                $this->assertTrue( unregister_taxonomy( 'foo' ) );
     613                $this->assertSame( array(), $wp_filter['wp_ajax_add-foo'] );
     614        }
    520615}
  • tests/phpunit/tests/term.php

    diff --git tests/phpunit/tests/term.php tests/phpunit/tests/term.php
    index 1fdbd14..d206431 100644
    class Tests_Term extends WP_UnitTestCase { 
    243243                $this->assertNotEmpty( $added2 );
    244244                $this->assertEqualSets( array( $t1, $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
    245245
    246                 _unregister_taxonomy( 'wptests_tax' );
     246                unregister_taxonomy( 'wptests_tax' );
    247247        }
    248248
    249249        public function test_wp_set_object_terms_append_false() {
    class Tests_Term extends WP_UnitTestCase { 
    264264                $this->assertNotEmpty( $added2 );
    265265                $this->assertEqualSets( array( $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
    266266
    267                 _unregister_taxonomy( 'wptests_tax' );
     267                unregister_taxonomy( 'wptests_tax' );
    268268        }
    269269
    270270        public function test_wp_set_object_terms_append_default_to_false() {
    class Tests_Term extends WP_UnitTestCase { 
    285285                $this->assertNotEmpty( $added2 );
    286286                $this->assertEqualSets( array( $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
    287287
    288                 _unregister_taxonomy( 'wptests_tax' );
     288                unregister_taxonomy( 'wptests_tax' );
    289289        }
    290290
    291291        function test_change_object_terms_by_id() {
  • tests/phpunit/tests/term/cache.php

    diff --git tests/phpunit/tests/term/cache.php tests/phpunit/tests/term/cache.php
    index 828917a..bf10fab 100644
    class Tests_Term_Cache extends WP_UnitTestCase { 
    9191                        }
    9292                }
    9393
    94                 _unregister_taxonomy( $tax );
     94                unregister_taxonomy( $tax );
    9595        }
    9696
    9797        public function test_get_term_should_update_term_cache_when_passed_an_object() {
    class Tests_Term_Cache extends WP_UnitTestCase { 
    198198
    199199                $this->assertSame( $num_queries, $wpdb->num_queries );
    200200
    201                 _unregister_taxonomy( 'wptests_tax' );
     201                unregister_taxonomy( 'wptests_tax' );
    202202        }
    203203}
  • tests/phpunit/tests/term/getTerm.php

    diff --git tests/phpunit/tests/term/getTerm.php tests/phpunit/tests/term/getTerm.php
    index 7aeb3f3..fac495e 100644
    class Tests_Term_GetTerm extends WP_UnitTestCase { 
    211211        public function test_should_return_error_when_only_matching_term_is_in_an_invalid_taxonomy() {
    212212                $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    213213
    214                 _unregister_taxonomy( 'wptests_tax' );
     214                unregister_taxonomy( 'wptests_tax' );
    215215
    216216                $found = get_term( $t );
    217217                $this->assertWPError( $found );
    class Tests_Term_GetTerm extends WP_UnitTestCase { 
    224224        public function test_term_should_be_returned_when_id_is_shared_only_with_invalid_taxonomies() {
    225225                $terms = $this->generate_shared_terms();
    226226
    227                 _unregister_taxonomy( 'wptests_tax' );
     227                unregister_taxonomy( 'wptests_tax' );
    228228
    229229                $found = get_term( $terms[1]['term_id'] );
    230230                $this->assertInstanceOf( 'WP_Term', $found );
  • tests/phpunit/tests/term/getTerms.php

    diff --git tests/phpunit/tests/term/getTerms.php tests/phpunit/tests/term/getTerms.php
    index bcd3485..d771aaa 100644
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    192192
    193193                $this->assertEquals( array( $terms[1] ), wp_list_pluck( $found, 'term_id' ) );
    194194
    195                 _unregister_taxonomy( 'wptests_tax' );
     195                unregister_taxonomy( 'wptests_tax' );
    196196        }
    197197
    198198        /**
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    336336                $this->assertEquals( 1, count( $terms ) );
    337337                $this->assertEquals( array( 'Cheese' ), wp_list_pluck( $terms, 'name' ) );
    338338
    339                 _unregister_taxonomy( $tax );
     339                unregister_taxonomy( $tax );
    340340        }
    341341
    342342        /**
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    360360                $this->assertEquals( 1, count( $terms ) );
    361361                $this->assertEquals( array( 'term1' ), wp_list_pluck( $terms, 'name' ) );
    362362
    363                 _unregister_taxonomy( $tax );
     363                unregister_taxonomy( $tax );
    364364        }
    365365
    366366        /**
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    697697                        $terms['grandchild1'],
    698698                );
    699699
    700                 _unregister_taxonomy( 'hierarchical_fields' );
     700                unregister_taxonomy( 'hierarchical_fields' );
    701701
    702702                $this->assertEqualSets( $expected, $found );
    703703        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    720720                        $terms['child1'],
    721721                );
    722722
    723                 _unregister_taxonomy( 'hierarchical_fields' );
     723                unregister_taxonomy( 'hierarchical_fields' );
    724724
    725725                $this->assertEqualSets( $expected, $found );
    726726        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    743743                        $terms['child1'],
    744744                );
    745745
    746                 _unregister_taxonomy( 'hierarchical_fields' );
     746                unregister_taxonomy( 'hierarchical_fields' );
    747747
    748748                $this->assertEqualSets( $expected, $found );
    749749        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    768768                        'Grandchild 1',
    769769                );
    770770
    771                 _unregister_taxonomy( 'hierarchical_fields' );
     771                unregister_taxonomy( 'hierarchical_fields' );
    772772
    773773                $this->assertEqualSets( $expected, $found );
    774774        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    791791                        'Child 1',
    792792                );
    793793
    794                 _unregister_taxonomy( 'hierarchical_fields' );
     794                unregister_taxonomy( 'hierarchical_fields' );
    795795
    796796                $this->assertEqualSets( $expected, $found );
    797797        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    814814                        'Child 1',
    815815                );
    816816
    817                 _unregister_taxonomy( 'hierarchical_fields' );
     817                unregister_taxonomy( 'hierarchical_fields' );
    818818
    819819                $this->assertEqualSets( $expected, $found );
    820820        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    831831                        'fields' => 'count',
    832832                ) );
    833833
    834                 _unregister_taxonomy( 'hierarchical_fields' );
     834                unregister_taxonomy( 'hierarchical_fields' );
    835835
    836836                $this->assertEquals( 5, $found );
    837837        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    848848                        'fields' => 'count',
    849849                ) );
    850850
    851                 _unregister_taxonomy( 'hierarchical_fields' );
     851                unregister_taxonomy( 'hierarchical_fields' );
    852852
    853853                // When using 'fields=count', 'hierarchical' is forced to false.
    854854                $this->assertEquals( 2, $found );
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    867867                        'hierarchical' => false,
    868868                ) );
    869869
    870                 _unregister_taxonomy( 'hierarchical_fields' );
     870                unregister_taxonomy( 'hierarchical_fields' );
    871871
    872872                $this->assertEquals( 2, $found );
    873873        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    892892                        $terms['grandchild1'] => $terms['child1'],
    893893                );
    894894
    895                 _unregister_taxonomy( 'hierarchical_fields' );
     895                unregister_taxonomy( 'hierarchical_fields' );
    896896
    897897                $this->assertEqualSetsWithIndex( $expected, $found );
    898898        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    915915                        $terms['child1'] => $terms['parent1'],
    916916                );
    917917
    918                 _unregister_taxonomy( 'hierarchical_fields' );
     918                unregister_taxonomy( 'hierarchical_fields' );
    919919
    920920                $this->assertEqualSetsWithIndex( $expected, $found );
    921921        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    938938                        $terms['child1'] => $terms['parent1'],
    939939                );
    940940
    941                 _unregister_taxonomy( 'hierarchical_fields' );
     941                unregister_taxonomy( 'hierarchical_fields' );
    942942
    943943                $this->assertEqualSetsWithIndex( $expected, $found );
    944944        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    963963                        $terms['grandchild1'] => 'grandchild-1',
    964964                );
    965965
    966                 _unregister_taxonomy( 'hierarchical_fields' );
     966                unregister_taxonomy( 'hierarchical_fields' );
    967967
    968968                $this->assertEqualSetsWithIndex( $expected, $found );
    969969        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    989989                        $terms['child1'] => 'child-1',
    990990                );
    991991
    992                 _unregister_taxonomy( 'hierarchical_fields' );
     992                unregister_taxonomy( 'hierarchical_fields' );
    993993
    994994                $this->assertEqualSetsWithIndex( $expected, $found );
    995995        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    10121012                        $terms['child1'] => 'child-1',
    10131013                );
    10141014
    1015                 _unregister_taxonomy( 'hierarchical_fields' );
     1015                unregister_taxonomy( 'hierarchical_fields' );
    10161016
    10171017                $this->assertEqualSetsWithIndex( $expected, $found );
    10181018        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    10371037                        $terms['grandchild1'] => 'Grandchild 1',
    10381038                );
    10391039
    1040                 _unregister_taxonomy( 'hierarchical_fields' );
     1040                unregister_taxonomy( 'hierarchical_fields' );
    10411041
    10421042                $this->assertEqualSetsWithIndex( $expected, $found );
    10431043        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    10631063                        $terms['child1'] => 'Child 1',
    10641064                );
    10651065
    1066                 _unregister_taxonomy( 'hierarchical_fields' );
     1066                unregister_taxonomy( 'hierarchical_fields' );
    10671067
    10681068                $this->assertEqualSetsWithIndex( $expected, $found );
    10691069        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    10861086                        $terms['child1'] => 'Child 1',
    10871087                );
    10881088
    1089                 _unregister_taxonomy( 'hierarchical_fields' );
     1089                unregister_taxonomy( 'hierarchical_fields' );
    10901090
    10911091                $this->assertEqualSetsWithIndex( $expected, $found );
    10921092        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    11521152                        'hide_empty' => false,
    11531153                ) );
    11541154
    1155                 _unregister_taxonomy( 'wptests_tax' );
     1155                unregister_taxonomy( 'wptests_tax' );
    11561156
    11571157                $this->assertEquals( array( $t4, $t1, $t2 ), $found );
    11581158        }
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    11751175                        'hide_empty' => false,
    11761176                ) );
    11771177
    1178                 _unregister_taxonomy( 'wptests_tax' );
     1178                unregister_taxonomy( 'wptests_tax' );
    11791179
    11801180                $this->assertEquals( array( $t2, $t1, $t4, $t3 ), $found );
    11811181        }
  • tests/phpunit/tests/term/isObjectInTerm.php

    diff --git tests/phpunit/tests/term/isObjectInTerm.php tests/phpunit/tests/term/isObjectInTerm.php
    index 0da95ab..ef8a87c 100644
    class Tests_IsObjectInTerm extends WP_UnitTestCase { 
    1616                $this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1, $t2 ) ) );
    1717                $this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1, $t2 ) ) );
    1818
    19                 _unregister_taxonomy( 'wptests_tax', 'post' );
     19                unregister_taxonomy( 'wptests_tax', 'post' );
    2020        }
    2121
    2222        public function test_terms_are_strings_and_match_term_id() {
    class Tests_IsObjectInTerm extends WP_UnitTestCase { 
    3434                $this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1_str, $t2_str ) ) );
    3535                $this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1_str, $t2_str ) ) );
    3636
    37                 _unregister_taxonomy( 'wptests_tax', 'post' );
     37                unregister_taxonomy( 'wptests_tax', 'post' );
    3838        }
    3939
    4040        public function test_terms_are_strings_and_match_term_name() {
    class Tests_IsObjectInTerm extends WP_UnitTestCase { 
    4949                $this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( 'Foo', 'Bar' ) ) );
    5050                $this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( 'Foo', 'Bar' ) ) );
    5151
    52                 _unregister_taxonomy( 'wptests_tax', 'post' );
     52                unregister_taxonomy( 'wptests_tax', 'post' );
    5353        }
    5454
    5555        public function test_terms_are_strings_and_match_term_slug() {
    class Tests_IsObjectInTerm extends WP_UnitTestCase { 
    6464                $this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( 'foo', 'bar' ) ) );
    6565                $this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( 'foo', 'bar' ) ) );
    6666
    67                 _unregister_taxonomy( 'wptests_tax', 'post' );
     67                unregister_taxonomy( 'wptests_tax', 'post' );
    6868        }
    6969
    7070        public function test_terms_contain_strings_and_ints_and_match_term_id_as_int() {
    class Tests_IsObjectInTerm extends WP_UnitTestCase { 
    7979                $this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1, 'bar' ) ) );
    8080                $this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1, 'bar' ) ) );
    8181
    82                 _unregister_taxonomy( 'wptests_tax', 'post' );
     82                unregister_taxonomy( 'wptests_tax', 'post' );
    8383        }
    8484
    8585        /**
  • tests/phpunit/tests/term/query.php

    diff --git tests/phpunit/tests/term/query.php tests/phpunit/tests/term/query.php
    index 2b717c7..597d964 100644
    class Tests_Tax_Query extends WP_UnitTestCase { 
    275275                // Only one JOIN is required with OR + IN.
    276276                $this->assertSame( 1, substr_count( $sql['join'], 'JOIN' ) );
    277277
    278                 _unregister_taxonomy( 'wptests_tax' );
     278                unregister_taxonomy( 'wptests_tax' );
    279279        }
    280280
    281281        /**
    class Tests_Tax_Query extends WP_UnitTestCase { 
    318318
    319319                $this->assertSame( 3, substr_count( $sql['join'], 'JOIN' ) );
    320320
    321                 _unregister_taxonomy( 'wptests_tax' );
     321                unregister_taxonomy( 'wptests_tax' );
    322322        }
    323323
    324324        /**
    class Tests_Tax_Query extends WP_UnitTestCase { 
    364364
    365365                $this->assertSame( 2, substr_count( $sql['join'], 'JOIN' ) );
    366366
    367                 _unregister_taxonomy( 'wptests_tax' );
     367                unregister_taxonomy( 'wptests_tax' );
    368368        }
    369369
    370370        /**
    class Tests_Tax_Query extends WP_UnitTestCase { 
    391391
    392392                $this->assertSame( $expected, $tq->get_sql( $wpdb->posts, 'ID' ) );
    393393
    394                 _unregister_taxonomy( 'wptests_tax' );
     394                unregister_taxonomy( 'wptests_tax' );
    395395        }
    396396
    397397        /**
    class Tests_Tax_Query extends WP_UnitTestCase { 
    418418
    419419                $this->assertSame( $expected, $tq->get_sql( $wpdb->posts, 'ID' ) );
    420420
    421                 _unregister_taxonomy( 'wptests_tax' );
     421                unregister_taxonomy( 'wptests_tax' );
    422422        }
    423423}
  • tests/phpunit/tests/term/termExists.php

    diff --git tests/phpunit/tests/term/termExists.php tests/phpunit/tests/term/termExists.php
    index b00b6e8..5c8e71e 100644
    class Tests_TermExists extends WP_UnitTestCase { 
    9696
    9797                $found = term_exists( 'child-term', 'foo', $parent_term );
    9898
    99                 _unregister_taxonomy( 'foo' );
     99                unregister_taxonomy( 'foo' );
    100100
    101101                $this->assertInternalType( 'array', $found );
    102102                $this->assertEquals( $t, $found['term_id'] );
    class Tests_TermExists extends WP_UnitTestCase { 
    122122
    123123                $found = term_exists( 'child-term', 'foo', 0 );
    124124
    125                 _unregister_taxonomy( 'foo' );
     125                unregister_taxonomy( 'foo' );
    126126
    127127                $this->assertSame( null, $found['term_id'] );
    128128        }
    class Tests_TermExists extends WP_UnitTestCase { 
    144144
    145145                $found = term_exists( 'Child Term', 'foo', $parent_term );
    146146
    147                 _unregister_taxonomy( 'foo' );
     147                unregister_taxonomy( 'foo' );
    148148
    149149                $this->assertInternalType( 'array', $found );
    150150                $this->assertEquals( $t, $found['term_id'] );
    class Tests_TermExists extends WP_UnitTestCase { 
    160160
    161161                $found = term_exists( 'kewl-dudez', 'foo' );
    162162
    163                 _unregister_taxonomy( 'foo' );
     163                unregister_taxonomy( 'foo' );
    164164
    165165                $this->assertInternalType( 'array', $found );
    166166                $this->assertEquals( $t, $found['term_id'] );
    class Tests_TermExists extends WP_UnitTestCase { 
    176176
    177177                $found = term_exists( 'Kewl Dudez', 'foo' );
    178178
    179                 _unregister_taxonomy( 'foo' );
     179                unregister_taxonomy( 'foo' );
    180180
    181181                $this->assertInternalType( 'array', $found );
    182182                $this->assertEquals( $t, $found['term_id'] );
    class Tests_TermExists extends WP_UnitTestCase { 
    192192
    193193                $found = term_exists( 'juicy-fruit' );
    194194
    195                 _unregister_taxonomy( 'foo' );
     195                unregister_taxonomy( 'foo' );
    196196
    197197                $this->assertInternalType( 'string', $found );
    198198                $this->assertEquals( $t, $found );
    class Tests_TermExists extends WP_UnitTestCase { 
    208208
    209209                $found = term_exists( 'Juicy Fruit' );
    210210
    211                 _unregister_taxonomy( 'foo' );
     211                unregister_taxonomy( 'foo' );
    212212
    213213                $this->assertInternalType( 'string', $found );
    214214                $this->assertEquals( $t, $found );
    class Tests_TermExists extends WP_UnitTestCase { 
    226226
    227227                // clean up
    228228                $this->assertTrue( wp_delete_term( $t['term_id'], 'wptests_tax' ) );
    229                 _unregister_taxonomy( 'wptests_tax' );
     229                unregister_taxonomy( 'wptests_tax' );
    230230        }
    231231
    232232        function test_term_exists_unknown() {
  • tests/phpunit/tests/term/wpInsertTerm.php

    diff --git tests/phpunit/tests/term/wpInsertTerm.php tests/phpunit/tests/term/wpInsertTerm.php
    index c3dea31..633dd48 100644
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    8989                $found = wp_insert_term( 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy', 'wptests_tax' );
    9090
    9191                $term = get_term( $found['term_id'], 'wptests_tax' );
    92                 _unregister_taxonomy( 'wptests_tax' );
     92                unregister_taxonomy( 'wptests_tax' );
    9393
    9494                $this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->name );
    9595        }
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    101101                ) );
    102102
    103103                $term = get_term( $found['term_id'], 'wptests_tax' );
    104                 _unregister_taxonomy( 'wptests_tax' );
     104                unregister_taxonomy( 'wptests_tax' );
    105105
    106106                $this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->description );
    107107        }
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    113113                ) );
    114114
    115115                $term = get_term( $found['term_id'], 'wptests_tax' );
    116                 _unregister_taxonomy( 'wptests_tax' );
     116                unregister_taxonomy( 'wptests_tax' );
    117117
    118118                // 'foo1' is cast to 0 in sanitize_term().
    119119                $this->assertSame( 0, $term->parent );
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    126126                ) );
    127127
    128128                $term = get_term( $found['term_id'], 'wptests_tax' );
    129                 _unregister_taxonomy( 'wptests_tax' );
     129                unregister_taxonomy( 'wptests_tax' );
    130130
    131131                $this->assertSame( 'quality', $term->slug );
    132132
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    139139                ) );
    140140
    141141                $term = get_term( $found['term_id'], 'wptests_tax' );
    142                 _unregister_taxonomy( 'wptests_tax' );
     142                unregister_taxonomy( 'wptests_tax' );
    143143
    144144                $this->assertSame( 'quality', $term->slug );
    145145        }
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    151151                ) );
    152152
    153153                $term = get_term( $found['term_id'], 'wptests_tax' );
    154                 _unregister_taxonomy( 'wptests_tax' );
     154                unregister_taxonomy( 'wptests_tax' );
    155155
    156156                $this->assertSame( 'quality', $term->slug );
    157157        }
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    434434                $created_term = get_term( $created['term_id'], 'wptests_tax' );
    435435                $this->assertSame( 'foo-2', $created_term->slug );
    436436
    437                 _unregister_taxonomy( 'wptests_tax', 'post' );
     437                unregister_taxonomy( 'wptests_tax', 'post' );
    438438        }
    439439
    440440        /**
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    461461
    462462                $this->assertSame( 'foo', $new_term->slug );
    463463
    464                 _unregister_taxonomy( 'wptests_tax', 'post' );
     464                unregister_taxonomy( 'wptests_tax', 'post' );
    465465        }
    466466
    467467        /**
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    496496                $this->assertSame( 'foo-2', $new_term->slug );
    497497                $this->assertNotEquals( $new_term->term_id, $term->term_id );
    498498
    499                 _unregister_taxonomy( 'wptests_tax', 'post' );
     499                unregister_taxonomy( 'wptests_tax', 'post' );
    500500        }
    501501
    502502        public function test_wp_insert_term_alias_of_no_term_group() {
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    514514                $updated_term_1 = get_term( $term_1->term_id, 'wptests_tax' );
    515515
    516516                $term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    517                 _unregister_taxonomy( 'wptests_tax' );
     517                unregister_taxonomy( 'wptests_tax' );
    518518
    519519                $this->assertSame( 0, $term_1->term_group );
    520520                $this->assertNotEmpty( $created_term->term_group );
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    538538                        'alias_of' => $term_2->slug,
    539539                ) );
    540540                $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    541                 _unregister_taxonomy( 'wptests_tax' );
     541                unregister_taxonomy( 'wptests_tax' );
    542542
    543543                $this->assertNotEmpty( $created_term->term_group );
    544544                $this->assertSame( $created_term->term_group, $term_2->term_group );
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    550550                        'alias_of' => 'foo',
    551551                ) );
    552552                $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    553                 _unregister_taxonomy( 'wptests_tax' );
     553                unregister_taxonomy( 'wptests_tax' );
    554554
    555555                $this->assertSame( 0, $created_term->term_group );
    556556        }
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    576576                $term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' );
    577577                $term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' );
    578578
    579                 _unregister_taxonomy( 'wptests_tax' );
     579                unregister_taxonomy( 'wptests_tax' );
    580580
    581581                $this->assertInternalType( 'array', $found );
    582582                $this->assertNotEmpty( $found['term_id'] );
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    607607                $found = wp_insert_term( 'foo', 'wptests_tax', array(
    608608                        'parent' => $t,
    609609                ) );
    610                 _unregister_taxonomy( 'wptests_tax' );
     610                unregister_taxonomy( 'wptests_tax' );
    611611
    612612                $this->assertSame( false, wp_cache_get( 'all_ids', 'wptests_tax' ) );
    613613                $this->assertSame( false, wp_cache_get( 'get', 'wptests_tax' ) );
  • tests/phpunit/tests/term/wpUpdateTerm.php

    diff --git tests/phpunit/tests/term/wpUpdateTerm.php tests/phpunit/tests/term/wpUpdateTerm.php
    index 4d9d17b..f7eea70 100644
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    2929                ) );
    3030
    3131                $term = get_term( $found['term_id'], 'wptests_tax' );
    32                 _unregister_taxonomy( 'wptests_tax' );
     32                unregister_taxonomy( 'wptests_tax' );
    3333
    3434                $this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->name );
    3535        }
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    4545                ) );
    4646
    4747                $term = get_term( $found['term_id'], 'wptests_tax' );
    48                 _unregister_taxonomy( 'wptests_tax' );
     48                unregister_taxonomy( 'wptests_tax' );
    4949
    5050                $this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->description );
    5151        }
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    6262
    6363                $this->assertTrue( is_wp_error( $found ) );
    6464                $this->assertSame( 'empty_term_name', $found->get_error_code() );
    65                 _unregister_taxonomy( 'wptests_tax' );
     65                unregister_taxonomy( 'wptests_tax' );
    6666        }
    6767
    6868        /**
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    8989
    9090                $term = get_term( $t, 'wptests_tax' );
    9191                $this->assertEquals( 0, $term->parent );
    92                 _unregister_taxonomy( 'wptests_tax' );
     92                unregister_taxonomy( 'wptests_tax' );
    9393        }
    9494
    9595        public function test_wp_update_term_slug_empty_string_while_not_updating_name() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    105105
    106106                $term = get_term( $t, 'wptests_tax' );
    107107                $this->assertSame( 'foo-bar', $term->slug );
    108                 _unregister_taxonomy( 'wptests_tax' );
     108                unregister_taxonomy( 'wptests_tax' );
    109109        }
    110110
    111111        public function test_wp_update_term_slug_empty_string_while_updating_name() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    121121
    122122                $term = get_term( $t, 'wptests_tax' );
    123123                $this->assertSame( 'foo-bar', $term->slug );
    124                 _unregister_taxonomy( 'wptests_tax' );
     124                unregister_taxonomy( 'wptests_tax' );
    125125        }
    126126
    127127        public function test_wp_update_term_slug_set_slug() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    136136
    137137                $term = get_term( $t, 'wptests_tax' );
    138138                $this->assertSame( 'foo-bar', $term->slug );
    139                 _unregister_taxonomy( 'wptests_tax' );
     139                unregister_taxonomy( 'wptests_tax' );
    140140        }
    141141
    142142        /**
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    314314                $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    315315
    316316                $updated_term_1 = get_term( $t1, 'wptests_tax' );
    317                 _unregister_taxonomy( 'wptests_tax' );
     317                unregister_taxonomy( 'wptests_tax' );
    318318
    319319                $this->assertSame( 0, $term_1->term_group );
    320320                $this->assertNotEmpty( $created_term->term_group );
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    339339                        'alias_of' => $term_2->slug,
    340340                ) );
    341341                $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    342                 _unregister_taxonomy( 'wptests_tax' );
     342                unregister_taxonomy( 'wptests_tax' );
    343343
    344344                $this->assertNotEmpty( $created_term->term_group );
    345345                $this->assertSame( $created_term->term_group, $term_2->term_group );
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    352352                        'alias_of' => 'bar',
    353353                ) );
    354354                $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
    355                 _unregister_taxonomy( 'wptests_tax' );
     355                unregister_taxonomy( 'wptests_tax' );
    356356
    357357                $this->assertSame( 0, $created_term->term_group );
    358358        }
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    372372
    373373                $this->assertSame( $t, $found['term_id'] );
    374374                $this->assertSame( 'foo', $term->slug );
    375                 _unregister_taxonomy( 'wptests_tax' );
     375                unregister_taxonomy( 'wptests_tax' );
    376376        }
    377377
    378378        public function test_wp_update_term_duplicate_slug_generated_due_to_empty_slug_param() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    395395
    396396                $this->assertSame( $t2, $found['term_id'] );
    397397                $this->assertSame( 'foo-bar-2', $term->slug );
    398                 _unregister_taxonomy( 'wptests_tax' );
     398                unregister_taxonomy( 'wptests_tax' );
    399399        }
    400400
    401401        public function test_wp_update_term_duplicate_slug_with_changed_parent() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    423423
    424424                $this->assertSame( $t2, $found['term_id'] );
    425425                $this->assertSame( 'foo-bar-' . $parent_term->slug, $term->slug );
    426                 _unregister_taxonomy( 'wptests_tax' );
     426                unregister_taxonomy( 'wptests_tax' );
    427427        }
    428428
    429429        public function test_wp_update_term_duplicate_slug_failure() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    446446                $this->assertWPError( $found );
    447447                $this->assertSame( 'duplicate_term_slug', $found->get_error_code() );
    448448                $this->assertSame( 'my-old-slug', $term->slug );
    449                 _unregister_taxonomy( 'wptests_tax' );
     449                unregister_taxonomy( 'wptests_tax' );
    450450        }
    451451
    452452        public function test_wp_update_term_should_return_term_id_and_term_taxonomy_id() {
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    462462                $term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' );
    463463                $term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' );
    464464
    465                 _unregister_taxonomy( 'wptests_tax' );
     465                unregister_taxonomy( 'wptests_tax' );
    466466
    467467                $this->assertInternalType( 'array', $found );
    468468                $this->assertNotEmpty( $found['term_id'] );
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    546546                $found = wp_update_term( $t1, 'wptests_tax', array(
    547547                        'parent' => $t2,
    548548                ) );
    549                 _unregister_taxonomy( 'wptests_tax' );
     549                unregister_taxonomy( 'wptests_tax' );
    550550
    551551                $this->assertSame( false, wp_cache_get( 'all_ids', 'wptests_tax' ) );
    552552                $this->assertSame( false, wp_cache_get( 'get', 'wptests_tax' ) );
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    585585
    586586                $this->assertSame( 'foo', $t2_term->slug );
    587587
    588                 _unregister_taxonomy( 'wptests_tax' );
     588                unregister_taxonomy( 'wptests_tax' );
    589589        }
    590590
    591591        /**
    class Tests_Term_WpUpdateTerm extends WP_UnitTestCase { 
    623623
    624624                $this->assertSame( 'foo', $t3_term->slug );
    625625
    626                 _unregister_taxonomy( 'wptests_tax' );
     626                unregister_taxonomy( 'wptests_tax' );
    627627        }
    628628
    629629        /**