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-04-02 08:15:18 +0300
committerdiosmosis <benaka@piwik.pro>2015-04-02 08:15:18 +0300
commit695bfe6c853cdd0afb4c37ac91dc612145fb4b60 (patch)
tree58ab5d8198318f41c7c3e7cf642f2255a2b8a726 /tests/PHPUnit/Framework/Mock/TestConfig.php
parent342f9454f5b5b32453fbbeb15da1ddc2515bd1fa (diff)
Remove uses of Config::init(), Config::clear() and Config::setTestEnvironment(). Replace last w/ mock config class, which is closer to use of DI.
Diffstat (limited to 'tests/PHPUnit/Framework/Mock/TestConfig.php')
-rw-r--r--tests/PHPUnit/Framework/Mock/TestConfig.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/PHPUnit/Framework/Mock/TestConfig.php b/tests/PHPUnit/Framework/Mock/TestConfig.php
new file mode 100644
index 0000000000..5a2e3ebc93
--- /dev/null
+++ b/tests/PHPUnit/Framework/Mock/TestConfig.php
@@ -0,0 +1,36 @@
+<?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\Mock;
+
+use Piwik\Config;
+use Piwik\Piwik;
+
+class TestConfig extends Config
+{
+ private $allowSave = false;
+ private $isSettingTestEnv = false;
+
+ public function __construct($pathGlobal = null, $pathLocal = null, $pathCommon = null, $allowSave = false)
+ {
+ parent::__construct($pathGlobal, $pathLocal, $pathCommon);
+
+ $this->allowSave = $allowSave;
+ }
+
+ public function reload()
+ {
+ if ($this->isSettingTestEnv) {
+ parent::reload();
+ } else {
+ $this->isSettingTestEnv = true;
+ $this->setTestEnvironment($this->getLocalPath(), $this->getGlobalPath(), $this->getCommonPath(), $this->allowSave);
+ $this->isSettingTestEnv = false;
+ }
+ }
+} \ No newline at end of file