Skip to content

Commit da001e8

Browse files
committed
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: #16267, #16268, #16269, #16272, #16274 Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65815 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 78d8e29 commit da001e8

5 files changed

Lines changed: 0 additions & 41 deletions

File tree

‎tests/phpunit/tests/adminbar.php‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,6 @@ public function test_admin_bar_has_no_archives_link_for_non_public_cpt() {
556556
$wp_admin_bar = $this->get_standard_admin_bar();
557557
$node = $wp_admin_bar->get_node( 'archive' );
558558

559-
unregister_post_type( 'foo-non-public' );
560-
561559
$this->assertNull( $node );
562560
}
563561

@@ -579,8 +577,6 @@ public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() {
579577
$wp_admin_bar = $this->get_standard_admin_bar();
580578
$node = $wp_admin_bar->get_node( 'archive' );
581579

582-
unregister_post_type( 'foo-non-public' );
583-
584580
$this->assertNull( $node );
585581
}
586582

@@ -602,8 +598,6 @@ public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_b
602598
$wp_admin_bar = $this->get_standard_admin_bar();
603599
$node = $wp_admin_bar->get_node( 'archive' );
604600

605-
unregister_post_type( 'foo-non-public' );
606-
607601
$this->assertNull( $node );
608602
}
609603

‎tests/phpunit/tests/block-templates/getTemplateHierarchy.php‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ public function set_up() {
2121
register_taxonomy( 'books', 'custom_book' );
2222
}
2323

24-
public function tear_down() {
25-
unregister_post_type( 'custom_book' );
26-
unregister_taxonomy( 'book_type' );
27-
unregister_taxonomy( 'books' );
28-
parent::tear_down();
29-
}
30-
3124
/**
3225
* @dataProvider data_get_template_hierarchy
3326
*

‎tests/phpunit/tests/icons/wpRestIconCollectionsController.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ public function tear_down() {
4848
}
4949
}
5050

51-
if ( post_type_exists( 'rest_icon_cpt' ) ) {
52-
unregister_post_type( 'rest_icon_cpt' );
53-
}
54-
5551
parent::tear_down();
5652
}
5753

‎tests/phpunit/tests/query/dateQuery.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,6 @@ public function test_date_query_with_taxonomy_join() {
990990
)
991991
);
992992

993-
_unregister_taxonomy( 'foo' );
994-
995993
$this->assertSame( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
996994
}
997995

‎tests/phpunit/tests/query/taxQuery.php‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,6 @@ public function test_tax_query_two_nested_queries() {
830830
)
831831
);
832832

833-
_unregister_taxonomy( 'foo' );
834-
_unregister_taxonomy( 'bar' );
835-
836833
$this->assertSameSets( array( $p1, $p2 ), $q->posts );
837834
}
838835

@@ -904,9 +901,6 @@ public function test_tax_query_one_nested_query_one_first_order_query() {
904901
)
905902
);
906903

907-
_unregister_taxonomy( 'foo' );
908-
_unregister_taxonomy( 'bar' );
909-
910904
$this->assertSameSets( array( $p1, $p2 ), $q->posts );
911905
}
912906

@@ -987,9 +981,6 @@ public function test_tax_query_one_double_nested_query_one_first_order_query() {
987981
)
988982
);
989983

990-
_unregister_taxonomy( 'foo' );
991-
_unregister_taxonomy( 'bar' );
992-
993984
$this->assertSameSets( array( $p1, $p2, $p3 ), $q->posts );
994985
}
995986

@@ -1413,8 +1404,6 @@ public function test_populate_taxonomy_query_var_from_tax_query() {
14131404
);
14141405

14151406
$this->assertSame( 'foo', $q->get( 'taxonomy' ) );
1416-
1417-
_unregister_taxonomy( 'foo' );
14181407
}
14191408

14201409
public function test_populate_taxonomy_query_var_from_tax_query_taxonomy_already_set() {
@@ -1439,9 +1428,6 @@ public function test_populate_taxonomy_query_var_from_tax_query_taxonomy_already
14391428
);
14401429

14411430
$this->assertSame( 'bar', $q->get( 'taxonomy' ) );
1442-
1443-
_unregister_taxonomy( 'foo' );
1444-
_unregister_taxonomy( 'foo1' );
14451431
}
14461432

14471433
public function test_populate_term_query_var_from_tax_query() {
@@ -1466,8 +1452,6 @@ public function test_populate_term_query_var_from_tax_query() {
14661452
);
14671453

14681454
$this->assertSame( 'bar', $q->get( 'term' ) );
1469-
1470-
_unregister_taxonomy( 'foo' );
14711455
}
14721456

14731457
public function test_populate_term_id_query_var_from_tax_query() {
@@ -1492,8 +1476,6 @@ public function test_populate_term_id_query_var_from_tax_query() {
14921476
);
14931477

14941478
$this->assertSame( $t, $q->get( 'term_id' ) );
1495-
1496-
_unregister_taxonomy( 'foo' );
14971479
}
14981480

14991481
/**
@@ -1539,8 +1521,6 @@ public function test_populate_cat_category_name_query_var_from_tax_query() {
15391521

15401522
$this->assertSame( $c, $q->get( 'cat' ) );
15411523
$this->assertSame( 'bar', $q->get( 'category_name' ) );
1542-
1543-
_unregister_taxonomy( 'foo' );
15441524
}
15451525

15461526
/**
@@ -1585,8 +1565,6 @@ public function test_populate_tag_id_query_var_from_tax_query() {
15851565
);
15861566

15871567
$this->assertSame( $tag, $q->get( 'tag_id' ) );
1588-
1589-
_unregister_taxonomy( 'foo' );
15901568
}
15911569

15921570
/**

0 commit comments

Comments
 (0)