aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-03-09 20:51:28 +0100
committerArthurHoaro <arthur@hoa.ro>2017-03-11 13:27:02 +0100
commitfe83d45c465bad94709ce5aacf7acad47ad75077 (patch)
treec9b1bcc7c6461f8d1846f376d2b94adadceed6e4 /tests/Updater
parent844021ab4c0d3dd6c26704648a736fa53244c914 (diff)
downloadShaarli-fe83d45c465bad94709ce5aacf7acad47ad75077.tar.gz
Shaarli-fe83d45c465bad94709ce5aacf7acad47ad75077.tar.zst
Shaarli-fe83d45c465bad94709ce5aacf7acad47ad75077.zip
Fix #773: set Piwik URL protocol
Diffstat (limited to 'tests/Updater')
-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}