diff --git a/tests/phpunit/tests/link.php b/tests/phpunit/tests/link.php index b9576a7a1a16a..ceb12d0c3900d 100644 --- a/tests/phpunit/tests/link.php +++ b/tests/phpunit/tests/link.php @@ -150,8 +150,6 @@ public function test_unattached_attachment_has_a_pretty_permalink() { * @ticket 1914 */ public function test_attachment_attached_to_non_existent_post_type_has_a_pretty_permalink() { - global $wp_post_types; - $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); register_post_type( 'not_a_post_type', array( 'public' => true ) ); @@ -175,12 +173,7 @@ public function test_attachment_attached_to_non_existent_post_type_has_a_pretty_ $this->assertSame( get_permalink( $post_id ) . user_trailingslashit( $attachment->post_name ), get_permalink( $attachment_id ) ); - foreach ( $wp_post_types as $id => $pt ) { - if ( 'not_a_post_type' === $pt->name ) { - unset( $wp_post_types[ $id ] ); - break; - } - } + unregister_post_type( 'not_a_post_type' ); $this->assertSame( home_url( "/?attachment_id={$attachment->ID}" ), get_permalink( $attachment_id ) ); // Visit permalink.