mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Preserve the public and private query var properties on the global WP
instance when using WP_UnitTestCase::go_to()
. These properties apply to the application state, not the current request.
See #34346 git-svn-id: https://develop.svn.wordpress.org/trunk@35258 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9fbff7f63a
commit
a314c6c234
@ -126,7 +126,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
global $wpdb, $wp_query, $post;
|
||||
global $wpdb, $wp_query, $wp, $post;
|
||||
$wpdb->query( 'ROLLBACK' );
|
||||
if ( is_multisite() ) {
|
||||
while ( ms_is_switched() ) {
|
||||
@ -134,6 +134,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
$wp_query = new WP_Query();
|
||||
$wp = new WP();
|
||||
$post = null;
|
||||
remove_theme_support( 'html5' );
|
||||
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
|
||||
@ -419,7 +420,14 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
|
||||
$GLOBALS['wp_the_query'] = new WP_Query();
|
||||
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
|
||||
|
||||
$public_query_vars = $GLOBALS['wp']->public_query_vars;
|
||||
$private_query_vars = $GLOBALS['wp']->private_query_vars;
|
||||
|
||||
$GLOBALS['wp'] = new WP();
|
||||
$GLOBALS['wp']->public_query_vars = $public_query_vars;
|
||||
$GLOBALS['wp']->private_query_vars = $private_query_vars;
|
||||
|
||||
_cleanup_query_vars();
|
||||
|
||||
$GLOBALS['wp']->main($parts['query']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user