diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-24 12:31:12 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-24 12:31:23 +0300 |
commit | 9c15aa8463acd877910bbf34cf4cc55455d98060 (patch) | |
tree | 50bae956195719b7dd3194e781df422fbeacdfb2 /tests/PHPUnit/Framework/Fixture.php | |
parent | af692a25c3e5cf09abaf6e108a8f9bc1cb3b9093 (diff) |
Make sure dbName testing environment variable is set properly in Fixture.php so UI tests w/ --persist-fixture-data will work correctly.
Diffstat (limited to 'tests/PHPUnit/Framework/Fixture.php')
-rw-r--r-- | tests/PHPUnit/Framework/Fixture.php | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 8beaf74734..b2289532b7 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -179,30 +179,27 @@ class Fixture extends \PHPUnit_Framework_Assert // TODO: don't use static var, use test env var for this TestingEnvironmentManipulator::$extraPluginsToLoad = $this->extraPluginsToLoad; + $this->dbName = $this->getDbName(); + + if ($this->persistFixtureData) { + $this->dropDatabaseInSetUp = false; + $this->dropDatabaseInTearDown = false; + $this->overwriteExisting = false; + $this->removeExistingSuperUser = false; + } + $this->getTestEnvironment()->testCaseClass = $this->testCaseClass; $this->getTestEnvironment()->fixtureClass = get_class($this); + $this->getTestEnvironment()->dbName = $this->dbName; $this->getTestEnvironment()->save(); $this->createEnvironmentInstance(); - try { - $this->dbName = $this->getDbName(); - - if ($this->persistFixtureData) { - $this->dropDatabaseInSetUp = false; - $this->dropDatabaseInTearDown = false; - $this->overwriteExisting = false; - $this->removeExistingSuperUser = false; - - Config::getInstance()->database_tests['dbname'] = Config::getInstance()->database['dbname'] = $this->dbName; - - $this->getTestEnvironment()->dbName = $this->dbName; - } - - if ($this->dbName === false) { // must be after test config is created - $this->dbName = Config::getInstance()->database['dbname']; - } + if ($this->dbName === false) { // must be after test config is created + $this->dbName = Config::getInstance()->database['dbname']; + } + try { static::connectWithoutDatabase(); if ($this->dropDatabaseInSetUp |