Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-06-12 01:48:49 +0300
committerdiosmosis <benaka@piwik.pro>2015-06-12 01:48:49 +0300
commitbb183ede23d1af1d26468582d01bb679ce76e41e (patch)
tree1d10b877df30f3347b0b170589b91826352e844a /tests/PHPUnit/bootstrap.php
parent95358189f82ed865aefd9c27aceb861e9929a6d0 (diff)
Workaround phpunit class loading issue caused by testing environment variables. Sometimes a test case class will be loaded before phpunit starts running (ie, in bootstrap.php), which causes the phpunit file loader to fail if a path to a test file is specified on the command line.
Diffstat (limited to 'tests/PHPUnit/bootstrap.php')
-rw-r--r--tests/PHPUnit/bootstrap.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 661b37ab38..2b3cdf0146 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();