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-01 09:00:37 +0300
committerdiosmosis <benaka@piwik.pro>2015-06-05 23:20:03 +0300
commit33cfb1d02cae5b1454d223f15acef9db1f65f77c (patch)
treef2a6d7c26e773037895a139e7e6d795036aa371b /tests/PHPUnit/Framework/TestingEnvironmentVariables.php
parent53a29ed2338094321bb077574e369e62231d62da (diff)
Move test environment setup logic from TestingEnvironmentVariables::addHooks() to a new EnvironmentManipulator. Remove MakeGlobalSettingsWithFile since it is now redundant.
Diffstat (limited to 'tests/PHPUnit/Framework/TestingEnvironmentVariables.php')
-rw-r--r--tests/PHPUnit/Framework/TestingEnvironmentVariables.php57
1 files changed, 1 insertions, 56 deletions
diff --git a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
index 158192fbaf..6be17a9812 100644
--- a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
+++ b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
@@ -9,9 +9,6 @@
namespace Piwik\Tests\Framework;
use Piwik\Plugin\Manager as PluginManager;
-use Exception;
-use Piwik\Container\StaticContainer;
-use Piwik\Tests\Framework\TestingEnvironment\MakeGlobalSettingsWithFile;
use Piwik\Piwik;
use Piwik\Application\Environment;
@@ -115,59 +112,7 @@ class TestingEnvironmentVariables
public static function addHooks($globalObservers = array())
{
$testingEnvironment = new TestingEnvironmentVariables();
-
- if ($testingEnvironment->queryParamOverride) {
- foreach ($testingEnvironment->queryParamOverride as $key => $value) {
- $_GET[$key] = $value;
- }
- }
-
- if ($testingEnvironment->globalsOverride) {
- foreach ($testingEnvironment->globalsOverride as $key => $value) {
- $GLOBALS[$key] = $value;
- }
- }
-
- if ($testingEnvironment->hostOverride) {
- \Piwik\Url::setHost($testingEnvironment->hostOverride);
- }
-
- if ($testingEnvironment->useXhprof) {
- \Piwik\Profiler::setupProfilerXHProf($mainRun = false, $setupDuringTracking = true);
- }
-
- // Apply DI config from the fixture
- $diConfig = array();
- if ($testingEnvironment->fixtureClass) {
- $fixtureClass = $testingEnvironment->fixtureClass;
- if (class_exists($fixtureClass)) {
- /** @var Fixture $fixture */
- $fixture = new $fixtureClass;
- $diConfig = $fixture->provideContainerConfig();
- }
- }
-
- if ($testingEnvironment->testCaseClass) {
- $testCaseClass = $testingEnvironment->testCaseClass;
- if (class_exists($testCaseClass)) {
- $testCase = new $testCaseClass();
-
- if (method_exists($testCase, 'provideContainerConfigBeforeClass')) {
- $diConfig = array_merge($diConfig, $testCaseClass::provideContainerConfigBeforeClass());
- }
-
- if (method_exists($testCase, 'provideContainerConfig')) {
- $diConfig = array_merge($diConfig, $testCase->provideContainerConfig());
- }
- }
- }
-
- \Piwik\Cache\Backend\File::$invalidateOpCacheBeforeRead = true;
-
- Environment::addEnvironmentManipulator(new MakeGlobalSettingsWithFile($testingEnvironment));
-
- StaticContainer::addDefinitions($diConfig);
- StaticContainer::addDefinitions(array('observers.global' => \DI\add($globalObservers)));
+ Environment::addEnvironmentManipulator(new TestingEnvironmentManipulator($testingEnvironment, $globalObservers));
}
/**