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:
Scott Taylor 2014-02-17 21:03:43 +00:00
parent 4283c76461
commit a31a167359
1 changed files with 3 additions and 1 deletions

View File

@ -32,9 +32,11 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
}
function tearDown() {
global $wpdb;
global $wpdb, $wp_query, $post;
$this->expectedDeprecated();
$wpdb->query( 'ROLLBACK' );
$wp_query = new WP_Query();
$post = null;
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );