Make WordPress Core

Changeset 65815


Ignore:
Timestamp:
11/28/2026 02:46:49 PM (11 hours ago)
Author:
lancewillett
Message:

Tests: Remove duplicate post type and taxonomy cleanup from five test classes.

Core resets these registrations before each test. Remove the trailing unregister calls from the admin bar, query, REST icon collection and block template tests. Keep the icon collection cleanup for its separate registry.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/16267, ​https://github.com/WordPress/wordpress-develop/pull/16268, ​https://github.com/WordPress/wordpress-develop/pull/16269, ​https://github.com/WordPress/wordpress-develop/pull/16272, ​https://github.com/WordPress/wordpress-develop/pull/16274

Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27.
See #66755.

Location:
trunk/tests/phpunit/tests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/adminbar.php

    r65325 r65815  
    557557                $node         = $wp_admin_bar->get_node( 'archive' );
    558558
    559                 unregister_post_type( 'foo-non-public' );
    560 
    561559                $this->assertNull( $node );
    562560        }
    … …  
    580578                $node         = $wp_admin_bar->get_node( 'archive' );
    581579
    582                 unregister_post_type( 'foo-non-public' );
    583 
    584580                $this->assertNull( $node );
    585581        }
    … …  
    602598                $wp_admin_bar = $this->get_standard_admin_bar();
    603599                $node         = $wp_admin_bar->get_node( 'archive' );
    604 
    605                 unregister_post_type( 'foo-non-public' );
    606600
    607601                $this->assertNull( $node );
  • trunk/tests/phpunit/tests/block-templates/getTemplateHierarchy.php

    r64741 r65815  
    2020                register_taxonomy( 'book_type', 'custom_book' );
    2121                register_taxonomy( 'books', 'custom_book' );
    22         }
    23 
    24         public function tear_down() {
    25                 unregister_post_type( 'custom_book' );
    26                 unregister_taxonomy( 'book_type' );
    27                 unregister_taxonomy( 'books' );
    28                 parent::tear_down();
    2922        }
    3023
  • trunk/tests/phpunit/tests/icons/wpRestIconCollectionsController.php

    r64991 r65815  
    4949                }
    5050
    51                 if ( post_type_exists( 'rest_icon_cpt' ) ) {
    52                         unregister_post_type( 'rest_icon_cpt' );
    53                 }
    54 
    5551                parent::tear_down();
    5652        }
  • trunk/tests/phpunit/tests/query/dateQuery.php

    r51568 r65815  
    990990                        )
    991991                );
    992 
    993                 _unregister_taxonomy( 'foo' );
    994992
    995993                $this->assertSame( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
  • trunk/tests/phpunit/tests/query/taxQuery.php

    r65284 r65815  
    831831                );
    832832
    833                 _unregister_taxonomy( 'foo' );
    834                 _unregister_taxonomy( 'bar' );
    835 
    836833                $this->assertSameSets( array( $p1, $p2 ), $q->posts );
    837834        }
    … …  
    904901                        )
    905902                );
    906 
    907                 _unregister_taxonomy( 'foo' );
    908                 _unregister_taxonomy( 'bar' );
    909903
    910904                $this->assertSameSets( array( $p1, $p2 ), $q->posts );
    … …  
    988982                );
    989983
    990                 _unregister_taxonomy( 'foo' );
    991                 _unregister_taxonomy( 'bar' );
    992 
    993984                $this->assertSameSets( array( $p1, $p2, $p3 ), $q->posts );
    994985        }
    … …  
    14141405
    14151406                $this->assertSame( 'foo', $q->get( 'taxonomy' ) );
    1416 
    1417                 _unregister_taxonomy( 'foo' );
    14181407        }
    14191408
    … …  
    14401429
    14411430                $this->assertSame( 'bar', $q->get( 'taxonomy' ) );
    1442 
    1443                 _unregister_taxonomy( 'foo' );
    1444                 _unregister_taxonomy( 'foo1' );
    14451431        }
    14461432
    … …  
    14671453
    14681454                $this->assertSame( 'bar', $q->get( 'term' ) );
    1469 
    1470                 _unregister_taxonomy( 'foo' );
    14711455        }
    14721456
    … …  
    14931477
    14941478                $this->assertSame( $t, $q->get( 'term_id' ) );
    1495 
    1496                 _unregister_taxonomy( 'foo' );
    14971479        }
    14981480
    … …  
    15401522                $this->assertSame( $c, $q->get( 'cat' ) );
    15411523                $this->assertSame( 'bar', $q->get( 'category_name' ) );
    1542 
    1543                 _unregister_taxonomy( 'foo' );
    15441524        }
    15451525
    … …  
    15861566
    15871567                $this->assertSame( $tag, $q->get( 'tag_id' ) );
    1588 
    1589                 _unregister_taxonomy( 'foo' );
    15901568        }
    15911569
Note: See TracChangeset for help on using the changeset viewer.