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:
Diffstat (limited to 'plugins/CustomVariables/tests/Integration/CustomVariablesTest.php')
-rw-r--r--plugins/CustomVariables/tests/Integration/CustomVariablesTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php
new file mode 100644
index 0000000000..25a158589e
--- /dev/null
+++ b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php
@@ -0,0 +1,43 @@
+<?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\Plugins\CustomVariables\tests;
+use Piwik\Plugins\CustomVariables\CustomVariables;
+use Piwik\Tracker\Cache;
+
+/**
+ * @group CustomVariables
+ * @group CustomVariablesTest
+ * @group Plugins
+ */
+class CustomVariablesTest extends \IntegrationTestCase
+{
+ public function testGetMaxCustomVariables_ShouldDetectCorrectNumberOfVariables()
+ {
+ Cache::clearCacheGeneral();
+ $this->assertSame(5, CustomVariables::getMaxCustomVariables());
+ }
+
+ public function testGetMaxCustomVariables_ShouldCacheTheResult()
+ {
+ CustomVariables::getMaxCustomVariables();
+ $cache = Cache::getCacheGeneral();
+
+ $this->assertSame(5, $cache['CustomVariables.MaxNumCustomVariables']);
+ }
+
+ public function testGetMaxCustomVariables_ShouldReadFromCacheIfPossible()
+ {
+ $cache = Cache::getCacheGeneral();
+ $cache['CustomVariables.MaxNumCustomVariables'] = 10;
+ Cache::setCacheGeneral($cache);
+
+ $this->assertSame(10, CustomVariables::getMaxCustomVariables());
+ }
+
+}