Skip to content

Commit d534f36

Browse files
committed
Tests: Clean up taxonomies in term lookup and count tests.
Unregister custom taxonomies during teardown in the `get_term_by()` and term-count tests. Preserve parent cleanup and prevent test-owned registrations from leaking into later tests. Developed in: #15043, #15044 Props rejaulalomkhan, mukeshpanchal27. See #65893. git-svn-id: https://develop.svn.wordpress.org/trunk@65015 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 57c66f0 commit d534f36

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎tests/phpunit/tests/term/getTermBy.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
77

88
protected $query = '';
99

10+
public function tear_down() {
11+
unregister_taxonomy( 'wptests_tax' );
12+
13+
parent::tear_down();
14+
}
15+
1016
public function test_get_term_by_slug() {
1117
$term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
1218
$term2 = get_term_by( 'slug', 'foo', 'category' );

‎tests/phpunit/tests/term/termCounts.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public function set_up() {
6767
self::register_taxonomies();
6868
}
6969

70+
public function tear_down() {
71+
unregister_taxonomy( 'wp_test_tax_counts' );
72+
unregister_taxonomy( 'wp_test_user_tax_counts' );
73+
parent::tear_down();
74+
}
75+
7076
/**
7177
* Register taxonomies used by tests.
7278
*

0 commit comments

Comments
 (0)