Repository navigation
Tests: Unregister custom taxonomies and post type in taxonomy tests teardown #14952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,30 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { | |
| self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Tear down after each test. | ||
| */ | ||
| public function tear_down() { | ||
| unregister_taxonomy( 'wptests_tax' ); | ||
| unregister_taxonomy( 'wptests_tax_1' ); | ||
| unregister_taxonomy( 'wptests_tax_2' ); | ||
| unregister_taxonomy( 'wptests_conflict' ); | ||
| unregister_taxonomy( 'taxonomy53212' ); | ||
| unregister_taxonomy( 'random' ); | ||
| unregister_taxonomy( 'foo' ); | ||
| unregister_taxonomy( 'tax_new' ); | ||
| unregister_taxonomy( 'test_tax' ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also replace the manual taxonomy unsets in AI review · |
||
| unregister_taxonomy( 'custom-tax' ); | ||
| unregister_taxonomy( 'test_tax1' ); | ||
| unregister_taxonomy( 'test_tax2' ); | ||
| unregister_post_type( 'test_cpt' ); | ||
| unregister_post_type( 'wptests_pt' ); | ||
| unregister_post_type( 'wptests_conflict' ); | ||
| unregister_post_type( 'post-custom-tax' ); | ||
| unregister_post_type( 'test_post_type' ); | ||
| parent::tear_down(); | ||
| } | ||
|
|
||
| public function test_get_post_taxonomies() { | ||
| $this->assertSame( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) ); | ||
| } | ||
|
|
@@ -212,7 +236,7 @@ public function test_register_taxonomy() { | |
| $this->assertFalse( is_taxonomy_hierarchical( $tax ) ); | ||
|
|
||
| // Clean up. | ||
| unset( $GLOBALS['wp_taxonomies'][ $tax ] ); | ||
| unregister_taxonomy( $tax ); | ||
| } | ||
|
|
||
| public function test_register_hierarchical_taxonomy() { | ||
|
|
@@ -226,7 +250,7 @@ public function test_register_hierarchical_taxonomy() { | |
| $this->assertTrue( is_taxonomy_hierarchical( $tax ) ); | ||
|
|
||
| // Clean up. | ||
| unset( $GLOBALS['wp_taxonomies'][ $tax ] ); | ||
| unregister_taxonomy( $tax ); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -341,7 +365,7 @@ public function test_registering_taxonomies_to_object_types() { | |
| $this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) ); | ||
| $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) ); | ||
|
|
||
| unset( $GLOBALS['wp_taxonomies'][ $tax ] ); | ||
| unregister_taxonomy( $tax ); | ||
| _unregister_post_type( $post_type ); | ||
| } | ||
|
|
||
|
|
@@ -646,7 +670,6 @@ public function test_get_ancestors_taxonomy_post_type_conflict_resource_type_tax | |
| $this->assertSameSets( array( $p1 ), get_ancestors( $p2, 'wptests_conflict', 'post_type' ) ); | ||
| $this->assertSameSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict', 'taxonomy' ) ); | ||
| $this->assertSameSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict' ) ); | ||
| _unregister_post_type( 'wptests_pt' ); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.