From db14f4e2c9441b86418f10cafab9a7d3b097ac2e Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Wed, 4 Nov 2026 15:57:46 +0600 Subject: [PATCH 1/2] Tests: Clean up custom post type in Tests_AdminBar. See #65893. Props devmuhib009. --- tests/phpunit/tests/adminbar.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php index 22c3328582616..ecbf20c4ad915 100644 --- a/tests/phpunit/tests/adminbar.php +++ b/tests/phpunit/tests/adminbar.php @@ -36,6 +36,12 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$user_ids[] = self::$no_role_id; } + public function tear_down() { + unregister_post_type( 'content' ); + + parent::tear_down(); + } + /** * @ticket 21117 */ @@ -51,8 +57,6 @@ public function test_content_post_type() { $nodes = $admin_bar->get_nodes(); $this->assertFalse( $nodes['new-content']->parent ); $this->assertSame( 'new-content', $nodes['add-new-content']->parent ); - - _unregister_post_type( 'content' ); } /** From 4b5d7aacdbc07bd8c0e20e51805d2d9659cddfee Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Thu, 5 Nov 2026 11:34:45 +0600 Subject: [PATCH 2/2] Tests: Clean up foo-non-public post type in Tests_AdminBar. See #65893. Props devmuhib009. --- tests/phpunit/tests/adminbar.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php index ecbf20c4ad915..044c9be9413bc 100644 --- a/tests/phpunit/tests/adminbar.php +++ b/tests/phpunit/tests/adminbar.php @@ -38,6 +38,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { public function tear_down() { unregister_post_type( 'content' ); + unregister_post_type( 'foo-non-public' ); parent::tear_down(); } @@ -560,8 +561,6 @@ public function test_admin_bar_has_no_archives_link_for_non_public_cpt() { $wp_admin_bar = $this->get_standard_admin_bar(); $node = $wp_admin_bar->get_node( 'archive' ); - unregister_post_type( 'foo-non-public' ); - $this->assertNull( $node ); } @@ -583,8 +582,6 @@ public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() { $wp_admin_bar = $this->get_standard_admin_bar(); $node = $wp_admin_bar->get_node( 'archive' ); - unregister_post_type( 'foo-non-public' ); - $this->assertNull( $node ); } @@ -606,8 +603,6 @@ public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_b $wp_admin_bar = $this->get_standard_admin_bar(); $node = $wp_admin_bar->get_node( 'archive' ); - unregister_post_type( 'foo-non-public' ); - $this->assertNull( $node ); }