Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions tests/phpunit/includes/abstract-testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,22 @@ public function wp_hash_password_options( array $options, string $algorithm ): a
/**
* After a test method runs, resets any state in WordPress the test method might have changed.
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global WP_Query $wp_the_query Main WordPress query object.
* @global WP_Query $wp_query WordPress query object.
* @global WP $wp WordPress environment object.
* @global wpdb $wpdb WordPress database abstraction object.
* @global WP_Query $wp_the_query Main WordPress query object.
* @global WP_Query $wp_query WordPress query object.
* @global WP $wp WordPress environment object.
* @global WP_Rewrite $wp_rewrite WordPress rewrite rules object.
*/
public function tear_down() {
global $wpdb, $wp_the_query, $wp_query, $wp;
global $wpdb, $wp_the_query, $wp_query, $wp, $wp_rewrite;

/*
* Reset permalinks before the transaction rolls back so the in-memory rewrite state
* remains synchronized with the restored database option for subsequent class fixtures.
*/
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && $wp_rewrite->permalink_structure ) {
$this->set_permalink_structure( '' );
}

$wpdb->query( 'ROLLBACK' );

Expand Down
Loading