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:
authorThomas Steur <tsteur@users.noreply.github.com>2020-09-29 05:55:42 +0300
committerGitHub <noreply@github.com>2020-09-29 05:55:42 +0300
commit6712ead7ef498fd49ca24c73dca9f15dfa8f063c (patch)
tree2b94457a87a57d48c48088ac113ae51403d5f99a
parent827c74be47b66c3e4c32e4e1b3925c64aab467ef (diff)
Add test for config set migration (#16487)
-rw-r--r--tests/PHPUnit/Integration/Updater/Migration/Config/SetTest.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/Updater/Migration/Config/SetTest.php b/tests/PHPUnit/Integration/Updater/Migration/Config/SetTest.php
new file mode 100644
index 0000000000..63f6961322
--- /dev/null
+++ b/tests/PHPUnit/Integration/Updater/Migration/Config/SetTest.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Matomo - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Integration\Updater\Migration\Config;
+
+use Piwik\Config;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+use Piwik\Updater\Migration\Config\Set;
+
+/**
+ * @group Core
+ * @group Updater
+ * @group Migration
+ */
+class SetTest extends IntegrationTestCase
+{
+ public function test_toString()
+ {
+ $config = $this->configSet('General', 'foo', 'bar');
+
+ $this->assertSame('./console config:set --section="General" --key="foo" --value="bar"', '' . $config);
+ }
+
+ public function test_exec_knownSectionKnownKey()
+ {
+ $this->configSet('General', 'time_before_today_archive_considered_outdated', 876)->exec();
+
+ $general = Config::getInstance()->General;
+ $this->assertEquals('876', $general['time_before_today_archive_considered_outdated']);
+ }
+
+ public function test_exec_knownSectionUnknownKey()
+ {
+ $this->configSet('General', 'foobar', '192')->exec();
+ $general = Config::getInstance()->General;
+ $this->assertEquals('192', $general['foobar']);
+ }
+
+ public function test_exec_unknownCategory()
+ {
+ $this->configSet('foobar', 'baz', 'hello')->exec();
+
+ $baz = Config::getInstance()->foobar;
+ $this->assertEquals('hello', $baz['baz']);
+ }
+
+ private function configSet($section, $key, $value)
+ {
+ return new Set($section, $key, $value);
+ }
+
+
+}