Skip to content

Commit d7bce3c

Browse files
committed
Tests: Clean up custom post types in query field tests.
Unregister the fixture post types used by the query fields-clause and search tests during teardown. Developed in: #14916 Props huzaifaalmesbah. See #65893. git-svn-id: https://develop.svn.wordpress.org/trunk@64840 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 44d5981 commit d7bce3c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎tests/phpunit/tests/query/fieldsClause.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
2727
self::$post_ids = $factory->post->create_many( 5, array( 'post_type' => 'wptests_pt' ) );
2828
}
2929

30+
public static function wpTearDownAfterClass() {
31+
unregister_post_type( 'wptests_pt' );
32+
}
33+
3034
public function set_up() {
3135
parent::set_up();
3236
/*
@@ -39,6 +43,11 @@ public function set_up() {
3943
register_post_type( 'wptests_pt' );
4044
}
4145

46+
public function tear_down() {
47+
unregister_post_type( 'wptests_pt' );
48+
parent::tear_down();
49+
}
50+
4251
/**
4352
* Tests limiting the WP_Query fields to the ID and parent sub-set.
4453
*

‎tests/phpunit/tests/query/search.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function set_up() {
1717
}
1818

1919
public function tear_down() {
20+
unregister_post_type( $this->post_type );
2021
unset( $this->q );
2122

2223
parent::tear_down();

0 commit comments

Comments
 (0)