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:
authorThaDafinser <martin.keckeis@thyssenkrupp.com>2015-09-02 11:29:03 +0300
committerThaDafinser <martin.keckeis@thyssenkrupp.com>2015-09-02 11:29:03 +0300
commit93f4c414a3276a0ec62894caab32d2e7eca064f5 (patch)
tree303cbe55b436bb6d98253717536f70edf0c30ff7 /tests/PHPUnit/Framework/TestingEnvironmentVariables.php
parent8d96c6961a4ca01a3cd505ccbebd364fbcf8b838 (diff)
fixing folder already exists
Diffstat (limited to 'tests/PHPUnit/Framework/TestingEnvironmentVariables.php')
-rw-r--r--tests/PHPUnit/Framework/TestingEnvironmentVariables.php186
1 files changed, 94 insertions, 92 deletions
diff --git a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
index 923ac39152..b2548837b3 100644
--- a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
+++ b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php
@@ -1,93 +1,95 @@
-<?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;
-
-use Piwik\Plugin\Manager as PluginManager;
-
-/**
- * Sets the test environment.
- *
- * For testing purposes, we don't want this class to reference PIWIK_INCLUDE_PATH or other constants.
- */
-class TestingEnvironmentVariables
-{
- private $behaviorOverrideProperties = array();
-
- public function __construct()
- {
- $this->reload();
- }
-
- public function __get($key)
- {
- return isset($this->behaviorOverrideProperties[$key]) ? $this->behaviorOverrideProperties[$key] : null;
- }
-
- public function __set($key, $value)
- {
- $this->behaviorOverrideProperties[$key] = $value;
- }
-
- public function __isset($name)
- {
- return isset($this->behaviorOverrideProperties[$name]);
- }
-
- public function save()
- {
- $includePath = __DIR__ . '/../../..';
-
- @mkdir($includePath . '/tmp');
-
- $overridePath = $includePath . '/tmp/testingPathOverride.json';
- file_put_contents($overridePath, json_encode($this->behaviorOverrideProperties));
- }
-
- public function delete()
- {
- $this->behaviorOverrideProperties = array();
- $this->save();
- }
-
- public function getCoreAndSupportedPlugins()
- {
- $settings = new \Piwik\Application\Kernel\GlobalSettingsProvider();
- $pluginList = new \Piwik\Application\Kernel\PluginList($settings);
- $pluginManager = new PluginManager($pluginList);
-
- $disabledPlugins = $pluginList->getCorePluginsDisabledByDefault();
- $disabledPlugins[] = 'LoginHttpAuth';
- $disabledPlugins[] = 'ExampleVisualization';
-
- $disabledPlugins = array_diff($disabledPlugins, array(
- 'DBStats', 'ExampleUI', 'ExampleCommand', 'ExampleSettingsPlugin'
- ));
-
- $plugins = array_filter($pluginManager->readPluginsDirectory(), function ($pluginName) use ($disabledPlugins, $pluginManager) {
- if (in_array($pluginName, $disabledPlugins)) {
- return false;
- }
-
- return $pluginManager->isPluginBundledWithCore($pluginName)
- || $pluginManager->isPluginOfficialAndNotBundledWithCore($pluginName);
- });
-
- sort($plugins);
-
- return $plugins;
- }
-
- public function reload()
- {
- $overridePath = __DIR__ . '/../../../tmp/testingPathOverride.json';
- if (file_exists($overridePath)) {
- $this->behaviorOverrideProperties = json_decode(file_get_contents($overridePath), true);
- }
- }
+<?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;
+
+use Piwik\Plugin\Manager as PluginManager;
+
+/**
+ * Sets the test environment.
+ *
+ * For testing purposes, we don't want this class to reference PIWIK_INCLUDE_PATH or other constants.
+ */
+class TestingEnvironmentVariables
+{
+ private $behaviorOverrideProperties = array();
+
+ public function __construct()
+ {
+ $this->reload();
+ }
+
+ public function __get($key)
+ {
+ return isset($this->behaviorOverrideProperties[$key]) ? $this->behaviorOverrideProperties[$key] : null;
+ }
+
+ public function __set($key, $value)
+ {
+ $this->behaviorOverrideProperties[$key] = $value;
+ }
+
+ public function __isset($name)
+ {
+ return isset($this->behaviorOverrideProperties[$name]);
+ }
+
+ public function save()
+ {
+ $includePath = __DIR__ . '/../../..';
+
+ if(!file_exists($includePath . '/tmp')){
+ mkdir($includePath . '/tmp');
+ }
+
+ $overridePath = $includePath . '/tmp/testingPathOverride.json';
+ file_put_contents($overridePath, json_encode($this->behaviorOverrideProperties));
+ }
+
+ public function delete()
+ {
+ $this->behaviorOverrideProperties = array();
+ $this->save();
+ }
+
+ public function getCoreAndSupportedPlugins()
+ {
+ $settings = new \Piwik\Application\Kernel\GlobalSettingsProvider();
+ $pluginList = new \Piwik\Application\Kernel\PluginList($settings);
+ $pluginManager = new PluginManager($pluginList);
+
+ $disabledPlugins = $pluginList->getCorePluginsDisabledByDefault();
+ $disabledPlugins[] = 'LoginHttpAuth';
+ $disabledPlugins[] = 'ExampleVisualization';
+
+ $disabledPlugins = array_diff($disabledPlugins, array(
+ 'DBStats', 'ExampleUI', 'ExampleCommand', 'ExampleSettingsPlugin'
+ ));
+
+ $plugins = array_filter($pluginManager->readPluginsDirectory(), function ($pluginName) use ($disabledPlugins, $pluginManager) {
+ if (in_array($pluginName, $disabledPlugins)) {
+ return false;
+ }
+
+ return $pluginManager->isPluginBundledWithCore($pluginName)
+ || $pluginManager->isPluginOfficialAndNotBundledWithCore($pluginName);
+ });
+
+ sort($plugins);
+
+ return $plugins;
+ }
+
+ public function reload()
+ {
+ $overridePath = __DIR__ . '/../../../tmp/testingPathOverride.json';
+ if (file_exists($overridePath)) {
+ $this->behaviorOverrideProperties = json_decode(file_get_contents($overridePath), true);
+ }
+ }
} \ No newline at end of file