-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Config object to the DI container and override w/ TestConfig th…
…rough DI config. Replaced the singleton GlobalSettingsProvider hack w/ the concept of an EnvironmentManipulator (internal to Piwik, not to be used anywhere but TestingEnvironment.php).
- Loading branch information
diosmosis
committed
May 24, 2015
1 parent
0afc478
commit 38a51b0
Showing
12 changed files
with
127 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
namespace Piwik\Application; | ||
|
||
use Piwik\Application\Kernel\GlobalSettingsProvider; | ||
|
||
/** | ||
* Used to manipulate Environment instances before the container is created. | ||
* Only used by the testing environment setup code, shouldn't be used anywhere | ||
* else. | ||
*/ | ||
interface EnvironmentManipulator | ||
{ | ||
/** | ||
* Create a custom GlobalSettingsProvider kernel object, overriding the default behavior. | ||
* | ||
* @return GlobalSettingsProvider | ||
*/ | ||
public function makeGlobalSettingsProvider(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/PHPUnit/Framework/TestingEnvironment/MakeGlobalSettingsWithFile.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
namespace Piwik\Tests\Framework\TestingEnvironment; | ||
|
||
use Piwik\Application\EnvironmentManipulator; | ||
use Piwik\Application\Kernel\GlobalSettingsProvider; | ||
use Piwik\Tests\Framework\TestingEnvironment; | ||
|
||
class MakeGlobalSettingsWithFile implements EnvironmentManipulator | ||
{ | ||
private $configFileGlobal; | ||
private $configFileLocal; | ||
private $configFileCommon; | ||
|
||
public function __construct(\Piwik_TestingEnvironment $testingEnvironment) | ||
{ | ||
$this->configFileGlobal = $testingEnvironment->configFileGlobal; | ||
$this->configFileLocal = $testingEnvironment->configFileLocal; | ||
$this->configFileCommon = $testingEnvironment->configFileCommon; | ||
} | ||
|
||
public function makeGlobalSettingsProvider() | ||
{ | ||
return new GlobalSettingsProvider($this->configFileGlobal, $this->configFileLocal, $this->configFileCommon); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.