From e198eb56fa0269479ddcdcdf5bdc5b8f619a8e76 Mon Sep 17 00:00:00 2001 From: Muhibul Haque Date: Wed, 4 Nov 2026 15:49:47 +0600 Subject: [PATCH] Tests: Clean up custom post type in Tests_User_GetTheAuthorPosts. See #65893. Props devmuhib009. --- tests/phpunit/tests/user/getTheAuthorPosts.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/user/getTheAuthorPosts.php b/tests/phpunit/tests/user/getTheAuthorPosts.php index 3a0abac5debd5..d50912dbf6cb9 100644 --- a/tests/phpunit/tests/user/getTheAuthorPosts.php +++ b/tests/phpunit/tests/user/getTheAuthorPosts.php @@ -38,6 +38,12 @@ public function set_up() { setup_postdata( get_post( self::$post_id ) ); } + public function tear_down() { + unregister_post_type( 'wptests_pt' ); + + parent::tear_down(); + } + public function test_get_the_author_posts() { // Test with no global post, result should be 0 because no author is found. $this->assertSame( 0, get_the_author_posts() ); @@ -61,7 +67,5 @@ public function test_get_the_author_posts_with_custom_post_type() { $GLOBALS['post'] = $cpt_ids[0]; $this->assertSame( 2, get_the_author_posts() ); - - _unregister_post_type( 'wptests_pt' ); } }