diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 661b37ab383358485477cb973630176fb65d927f..2b3cdf01463c4a4faf41ba3b0fe2a4ae0362e4b5 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -46,7 +46,13 @@ if (getenv('PIWIK_USE_XHPROF') == 1) {
 
 // setup container for tests
 function setupRootContainer() {
-    Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
+    // before running tests, delete the TestingEnvironmentVariables file, since it can indirectly mess w/
+    // phpunit's class loading (if a test class is loaded in bootstrap.php, phpunit can't load it from a file,
+    // so executing the tests in a file will fail)
+    $vars = new TestingEnvironmentVariables();
+    $vars->delete();
+
+    Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator($vars));
 
     $rootTestEnvironment = new \Piwik\Application\Environment(null);
     $rootTestEnvironment->init();