aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater/UpdaterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Updater/UpdaterTest.php')
-rw-r--r--tests/Updater/UpdaterTest.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index 448405a3..b522d616 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -574,4 +574,45 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
574 $this->assertTrue($updater->updateMethodEscapeMarkdown()); 574 $this->assertTrue($updater->updateMethodEscapeMarkdown());
575 $this->assertFalse($this->conf->get('security.markdown_escape')); 575 $this->assertFalse($this->conf->get('security.markdown_escape'));
576 } 576 }
577
578 /**
579 * Test updateMethodPiwikUrl with valid data
580 */
581 public function testUpdatePiwikUrlValid()
582 {
583 $sandboxConf = 'sandbox/config';
584 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
585 $this->conf = new ConfigManager($sandboxConf);
586 $url = 'mypiwik.tld';
587 $this->conf->set('plugins.PIWIK_URL', $url);
588 $updater = new Updater([], [], $this->conf, true);
589 $this->assertTrue($updater->updateMethodPiwikUrl());
590 $this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
591
592 // reload from file
593 $this->conf = new ConfigManager($sandboxConf);
594 $this->assertEquals('http://'. $url, $this->conf->get('plugins.PIWIK_URL'));
595 }
596
597 /**
598 * Test updateMethodPiwikUrl without setting
599 */
600 public function testUpdatePiwikUrlEmpty()
601 {
602 $updater = new Updater([], [], $this->conf, true);
603 $this->assertTrue($updater->updateMethodPiwikUrl());
604 $this->assertEmpty($this->conf->get('plugins.PIWIK_URL'));
605 }
606
607 /**
608 * Test updateMethodPiwikUrl: valid URL, nothing to do
609 */
610 public function testUpdatePiwikUrlNothingToDo()
611 {
612 $url = 'https://mypiwik.tld';
613 $this->conf->set('plugins.PIWIK_URL', $url);
614 $updater = new Updater([], [], $this->conf, true);
615 $this->assertTrue($updater->updateMethodPiwikUrl());
616 $this->assertEquals($url, $this->conf->get('plugins.PIWIK_URL'));
617 }
577} 618}