diff options
Diffstat (limited to 'plugins/CustomVariables/tests/CustomVariablesTest.php')
-rw-r--r-- | plugins/CustomVariables/tests/CustomVariablesTest.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/CustomVariables/tests/CustomVariablesTest.php b/plugins/CustomVariables/tests/CustomVariablesTest.php new file mode 100644 index 0000000000..980401d608 --- /dev/null +++ b/plugins/CustomVariables/tests/CustomVariablesTest.php @@ -0,0 +1,43 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @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 Database + */ +class CustomVariablesTest extends \DatabaseTestCase +{ + 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()); + } + +} |