blogid = 1; $GLOBALS['current_blog'] = $GLOBALS['wpdb']->get_results('SELECT * from wp_blogs where blog_id=1'); } // make sure we're installed assert(true == is_blog_installed()); // include plugins for testing, if any if (is_dir(DIR_TESTPLUGINS)) { $plugins = glob(realpath(DIR_TESTPLUGINS).'/*.php'); foreach ($plugins as $plugin) include_once($plugin); } // needed for jacob's tests ini_set('include_path', ini_get('include_path') . ':'.ABSPATH.'/wp-includes'); define('PHPUnit_MAIN_METHOD', false); $original_wpdb = $GLOBALS['wpdb']; include_once(DIR_TESTDATA . '/sample_blogs.php'); // include all files in DIR_TESTCASE, and fetch all the WPTestCase descendents $files = wptest_get_all_test_files(DIR_TESTCASE); foreach ($files as $file) { require_once($file); } $classes = wptest_get_all_test_cases(); // some of jacob's tests clobber the wpdb object, so restore it $GLOBALS['wpdb'] = $original_wpdb; if ( isset($opts['l']) ) { wptest_listall_testcases($classes); } else { do_action('test_start'); // hide warnings during testing, since that's the normal WP behaviour error_reporting(E_ALL ^ E_NOTICE); // run the tests and print the results list ($result, $printer) = wptest_run_tests($classes, @$opts['t']); wptest_print_result($printer,$result); } if ( !isset($opts['n']) ) { // clean up the database drop_tables(); } ?>