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 04:01:47 +0300
committerdiosmosis <benaka@piwik.pro>2015-06-12 05:14:32 +0300
commita73f710ff43ddad326292407fa952c532d2a363a (patch)
tree29b573154fee9f12a273aa13c1f7bba6a6b5467d /core/Application
parentbb183ede23d1af1d26468582d01bb679ce76e41e (diff)
Load plugins in tests automatically through testing environment manipulation, instead of through a method in Fixture. Allows plugin environment configs to be loaded during tests.
Diffstat (limited to 'core/Application')
-rw-r--r--core/Application/Environment.php12
-rw-r--r--core/Application/EnvironmentManipulator.php9
2 files changed, 20 insertions, 1 deletions
diff --git a/core/Application/Environment.php b/core/Application/Environment.php
index 61df20a32f..8631a90ec0 100644
--- a/core/Application/Environment.php
+++ b/core/Application/Environment.php
@@ -139,7 +139,8 @@ class Environment
protected function getPluginListCached()
{
if ($this->pluginList === null) {
- $this->pluginList = $this->getPluginList();
+ $pluginList = $this->getPluginListOverride();
+ $this->pluginList = $pluginList ?: $this->getPluginList();
}
return $this->pluginList;
}
@@ -223,4 +224,13 @@ class Environment
return array();
}
}
+
+ private function getPluginListOverride()
+ {
+ if (self::$globalEnvironmentManipulator) {
+ return self::$globalEnvironmentManipulator->makePluginList($this->getGlobalSettingsCached());
+ } else {
+ return null;
+ }
+ }
}
diff --git a/core/Application/EnvironmentManipulator.php b/core/Application/EnvironmentManipulator.php
index 1740de6c44..d740096fd9 100644
--- a/core/Application/EnvironmentManipulator.php
+++ b/core/Application/EnvironmentManipulator.php
@@ -9,6 +9,7 @@
namespace Piwik\Application;
use Piwik\Application\Kernel\GlobalSettingsProvider;
+use Piwik\Application\Kernel\PluginList;
/**
* Used to manipulate Environment instances before the container is created.
@@ -25,6 +26,14 @@ interface EnvironmentManipulator
public function makeGlobalSettingsProvider();
/**
+ * Create a custom PluginList kernel object, overriding the default behavior.@deprecated
+ *
+ * @param GlobalSettingsProvider $globalSettingsProvider
+ * @return PluginList
+ */
+ public function makePluginList(GlobalSettingsProvider $globalSettingsProvider);
+
+ /**
* Invoked before the container is created.
*/
public function beforeContainerCreated();