WordPress.org

Make WordPress Core

Changeset 35258


Ignore:
Timestamp:
10/18/2015 05:00:40 AM (5 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r35257 r35258  
    127127
    128128    function tearDown() {
    129         global $wpdb, $wp_query, $post;
     129        global $wpdb, $wp_query, $wp, $post;
    130130        $wpdb->query( 'ROLLBACK' );
    131131        if ( is_multisite() ) {
     
    135135        }
    136136        $wp_query = new WP_Query();
     137        $wp = new WP();
    137138        $post = null;
    138139        remove_theme_support( 'html5' );
     
    420421        $GLOBALS['wp_the_query'] = new WP_Query();
    421422        $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
     423       
     424        $public_query_vars  = $GLOBALS['wp']->public_query_vars;
     425        $private_query_vars = $GLOBALS['wp']->private_query_vars;
     426
    422427        $GLOBALS['wp'] = new WP();
     428        $GLOBALS['wp']->public_query_vars  = $public_query_vars;
     429        $GLOBALS['wp']->private_query_vars = $private_query_vars;
     430
    423431        _cleanup_query_vars();
    424432
Note: See TracChangeset for help on using the changeset viewer.