aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-03-11 13:52:00 +0100
committerGitHub <noreply@github.com>2017-03-11 13:52:00 +0100
commit1739d6b314f410ee79d603f601f2845d55c48b4d (patch)
treec9b1bcc7c6461f8d1846f376d2b94adadceed6e4 /tests
parent844021ab4c0d3dd6c26704648a736fa53244c914 (diff)
parentfe83d45c465bad94709ce5aacf7acad47ad75077 (diff)
downloadShaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.tar.gz
Shaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.tar.zst
Shaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.zip
Merge pull request #799 from ArthurHoaro/plugins/piwik-url
Fix #773: set Piwik URL protocol
Diffstat (limited to 'tests')
-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}