< Global Catastrophe   (Previous) Table of Contents (Next)   Terms: Parent Class, TestCase >

Getting Around the Globals

Place this at the top of the script that sets up the environment:

global $current_blog, $current_site, $wp_rewrite, $wpdb;
$_SERVER['HTTP_HOST'] = 'localhost';

Add this property to your parent test case class that extends PHPUnit_Framework_TestCase:

protected $backupGlobals = false;