Reset `$wp_query` and `$post` during `WP_UnitTestCase::tearDown()` to avoid spillage of globals between tests.
See #26321. git-svn-id: https://develop.svn.wordpress.org/trunk@27183 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4283c76461
commit
a31a167359
|
@ -32,9 +32,11 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
global $wpdb;
|
global $wpdb, $wp_query, $post;
|
||||||
$this->expectedDeprecated();
|
$this->expectedDeprecated();
|
||||||
$wpdb->query( 'ROLLBACK' );
|
$wpdb->query( 'ROLLBACK' );
|
||||||
|
$wp_query = new WP_Query();
|
||||||
|
$post = null;
|
||||||
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
|
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
|
||||||
remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
|
remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
|
||||||
remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
|
remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
|
||||||
|
|
Loading…
Reference in New Issue