Index: tests/phpunit/includes/testcase.php
===================================================================
--- tests/phpunit/includes/testcase.php	(revision 35226)
+++ tests/phpunit/includes/testcase.php	(working copy)
@@ -14,11 +14,29 @@
 	protected static $hooks_saved = array();
 	protected static $ignore_files;
 
+	function __isset( $name ) {
+		return 'factory' === $name;
+	}
+
 	/**
 	 * @var WP_UnitTest_Factory
 	 */
-	protected static $factory;
+	function __get( $name ) {
+		if ( 'factory' === $name ) {
+			return self::factory();
+		}
+	}
 
+	protected static function factory() {
+		static $factory = null;
+
+		if ( ! $factory ) {
+			$factory = new WP_UnitTest_Factory();
+		}
+
+		return $factory;
+	}
+
 	public static function get_called_class() {
 		if ( function_exists( 'get_called_class' ) ) {
 			return get_called_class();
@@ -81,7 +99,6 @@
 		$wpdb->db_connect();
 		ini_set('display_errors', 1 );
 		$this->clean_up_global_scope();
-
 		/*
 		 * When running core tests, ensure that post types and taxonomies
 		 * are reset for each test. We skip this step for non-core tests,
