Make WordPress Core

Changeset 69 in tests


Ignore:
Timestamp:
11/02/2007 06:29:11 AM (18 years ago)
Author:
tellyworth
Message:

stop globals from polluting wp_query

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testlib/base.php

    r57 r69  
    9595        #$this->_q_ts = microtime(true);
    9696        #add_filter('query', array(&$this, '_query_filter'));
    97         define('SAVEQUERIES', true);
     97        #define('SAVEQUERIES', true);
    9898        global $wpdb;
    9999        $wpdb->queries = array();
     
    134134        }
    135135
    136         #query_posts($req);
    137136        $_SERVER['REQUEST_URI'] = $req;
     137        unset($_SERVER['PATH_INFO']);
    138138        $GLOBALS['wp'] =& new WP();
     139       
     140        // clean out globals to stop them polluting wp and wp_query
     141        foreach ($GLOBALS['wp']->public_query_vars as $v)
     142            unset($GLOBALS[$v]);
     143        foreach ($GLOBALS['wp']->private_query_vars as $v)
     144            unset($GLOBALS[$v]);
     145
    139146        $GLOBALS['wp']->main($parts['query']);
    140147    }
     
    282289}
    283290
    284 function wptest_run_tests($classes) {
     291function wptest_run_tests($classes, $classname='') {
    285292    $suite = new PHPUnit_Framework_TestSuite();
    286293    foreach ($classes as $testcase)
    287         $suite->addTestSuite($testcase);
     294        if (!$classname or strtolower($testcase) == strtolower($classname)) {
     295            echo "Adding $testcase\n";
     296            $suite->addTestSuite($testcase);
     297        }
    288298
    289299    #return PHPUnit::run($suite);
Note: See TracChangeset for help on using the changeset viewer.