Skip to content

Commit a56e73c

Browse files
committed
Tests: Clean up custom registrations in post and query tests.
Unregister the custom taxonomies and post types used by the publishing, lazy-load term metadata, and random content redirect tests after each test. Preserve the existing assertions and parent teardown. Developed in: #14994, #14997, #14998 Props rejaulalomkhan. See #65893. git-svn-id: https://develop.svn.wordpress.org/trunk@64865 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 56e209d commit a56e73c

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎tests/phpunit/tests/post/wpPublishPost.php‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
2222
self::$auto_draft_id = $factory->post->create( array( 'post_status' => 'auto-draft' ) );
2323
}
2424

25+
/**
26+
* Tear down after each test.
27+
*/
28+
public function tear_down() {
29+
unregister_taxonomy( 'tax_51292' );
30+
parent::tear_down();
31+
}
32+
2533
public function test_wp_publish_post() {
2634
$draft_id = self::factory()->post->create(
2735
array(

‎tests/phpunit/tests/query/lazyLoadTermMeta.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
4040
}
4141
}
4242

43+
public function tear_down() {
44+
unregister_taxonomy( 'wptests_tax' );
45+
parent::tear_down();
46+
}
47+
4348
/**
4449
* @ticket 57150
4550
* @covers ::wp_queue_posts_for_term_meta_lazyload

‎tests/phpunit/tests/query/randomContentRedirect.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ public function set_up(): void {
149149
add_filter( 'wp_redirect', array( $this, 'filter_wp_redirect' ), 10, 2 );
150150
}
151151

152+
public function tear_down(): void {
153+
unregister_post_type( 'wptests_book' );
154+
unregister_post_type( 'wptests_hidden' );
155+
unregister_post_type( 'wptests_unsearchable' );
156+
unregister_taxonomy( 'wptests_genre' );
157+
158+
parent::tear_down();
159+
}
160+
152161
/**
153162
* Captures the redirect and prevents it from being sent.
154163
*

0 commit comments

Comments
 (0)