diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-25 11:01:56 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-25 11:03:15 +0300 |
commit | 84fa5d941b739b4231750a7516ff026c7cac7d09 (patch) | |
tree | a8c40fa969a0c710c1377e8fc64c358e44a12c89 /tests/PHPUnit/Framework/Fixture.php | |
parent | bc82f973dc9345d460eed8377df1585515ac4c4d (diff) |
In SystemTestCase, override testing environment var using new Fixture property instead of through DI, so the change is reflected in child processes.
Diffstat (limited to 'tests/PHPUnit/Framework/Fixture.php')
-rw-r--r-- | tests/PHPUnit/Framework/Fixture.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 4cb80ad022..f25e6f4c2d 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -116,6 +116,8 @@ class Fixture extends \PHPUnit_Framework_Assert */ public $extraDefinitions = array(); + public $extraTestEnvVars = array(); + /** * @var Environment */ @@ -188,10 +190,16 @@ class Fixture extends \PHPUnit_Framework_Assert $this->removeExistingSuperUser = false; } - $this->getTestEnvironment()->testCaseClass = $this->testCaseClass; - $this->getTestEnvironment()->fixtureClass = get_class($this); - $this->getTestEnvironment()->dbName = $this->dbName; - $this->getTestEnvironment()->save(); + $testEnv = $this->getTestEnvironment(); + $testEnv->testCaseClass = $this->testCaseClass; + $testEnv->fixtureClass = get_class($this); + $testEnv->dbName = $this->dbName; + + foreach ($this->extraTestEnvVars as $name => $value) { + $testEnv->$name = $value; + } + + $testEnv->save(); $this->createEnvironmentInstance(); |