Make WordPress Core


Ignore:
Timestamp:
11/04/2013 10:46:44 PM (10 years ago)
Author:
wonderboymusic
Message:

WP_UnitTestCase::go_to() tried its best to clean up global space, but ultimately fell short. Because it was blowing away WP every time it was called, it was dropping all the query vars that were registered for custom taxonomies and custom post types (ouch).

Introduces _cleanup_query_vars(). This is a prerequisite for the unit tests on #20767. All unit tests pass with this change.

See #20767.
Fixes #25818.

File:
1 edited

Legend:

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

    r26005 r26006  
    187187        $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
    188188        $GLOBALS['wp'] = new WP();
    189 
    190         // clean out globals to stop them polluting wp and wp_query
    191         foreach ($GLOBALS['wp']->public_query_vars as $v) {
    192             unset($GLOBALS[$v]);
    193         }
    194         foreach ($GLOBALS['wp']->private_query_vars as $v) {
    195             unset($GLOBALS[$v]);
    196         }
     189        _cleanup_query_vars();
    197190
    198191        $GLOBALS['wp']->main($parts['query']);
Note: See TracChangeset for help on using the changeset viewer.