aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/updater/UpdaterTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2019-02-24 11:29:56 +0100
committerGitHub <noreply@github.com>2019-02-24 11:29:56 +0100
commit015314f3c6a1ce0b2c45fdb2fb0d36a15cab10f5 (patch)
treec805547e171afd615b90486fa8bd7656f5fb9090 /tests/updater/UpdaterTest.php
parent0ee11e93907f0132e3b25a185093047bcd6b141d (diff)
parent520d29578c57e476ece3bdd20c286d196b7b61b4 (diff)
downloadShaarli-015314f3c6a1ce0b2c45fdb2fb0d36a15cab10f5.tar.gz
Shaarli-015314f3c6a1ce0b2c45fdb2fb0d36a15cab10f5.tar.zst
Shaarli-015314f3c6a1ce0b2c45fdb2fb0d36a15cab10f5.zip
Merge pull request #1269 from ArthurHoaro/feature/remove-redirector
Remove the redirector setting
Diffstat (limited to 'tests/updater/UpdaterTest.php')
-rw-r--r--tests/updater/UpdaterTest.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php
index d7df5963..93bc86c1 100644
--- a/tests/updater/UpdaterTest.php
+++ b/tests/updater/UpdaterTest.php
@@ -287,17 +287,14 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
287 $this->conf = new ConfigManager($sandbox); 287 $this->conf = new ConfigManager($sandbox);
288 $title = '<script>alert("title");</script>'; 288 $title = '<script>alert("title");</script>';
289 $headerLink = '<script>alert("header_link");</script>'; 289 $headerLink = '<script>alert("header_link");</script>';
290 $redirectorUrl = '<script>alert("redirector");</script>';
291 $this->conf->set('general.title', $title); 290 $this->conf->set('general.title', $title);
292 $this->conf->set('general.header_link', $headerLink); 291 $this->conf->set('general.header_link', $headerLink);
293 $this->conf->set('redirector.url', $redirectorUrl);
294 $updater = new Updater(array(), array(), $this->conf, true); 292 $updater = new Updater(array(), array(), $this->conf, true);
295 $done = $updater->updateMethodEscapeUnescapedConfig(); 293 $done = $updater->updateMethodEscapeUnescapedConfig();
296 $this->assertTrue($done); 294 $this->assertTrue($done);
297 $this->conf->reload(); 295 $this->conf->reload();
298 $this->assertEquals(escape($title), $this->conf->get('general.title')); 296 $this->assertEquals(escape($title), $this->conf->get('general.title'));
299 $this->assertEquals(escape($headerLink), $this->conf->get('general.header_link')); 297 $this->assertEquals(escape($headerLink), $this->conf->get('general.header_link'));
300 $this->assertEquals(escape($redirectorUrl), $this->conf->get('redirector.url'));
301 unlink($sandbox . '.json.php'); 298 unlink($sandbox . '.json.php');
302 } 299 }
303 300
@@ -707,7 +704,6 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
707 } 704 }
708 705
709 /** 706 /**
710<<<<<<< HEAD
711 * Test updateMethodWebThumbnailer with thumbnails enabled. 707 * Test updateMethodWebThumbnailer with thumbnails enabled.
712 */ 708 */
713 public function testUpdateMethodWebThumbnailerEnabled() 709 public function testUpdateMethodWebThumbnailerEnabled()
@@ -812,4 +808,19 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
812 $linkDB = new LinkDB(self::$testDatastore, true, false); 808 $linkDB = new LinkDB(self::$testDatastore, true, false);
813 $this->assertTrue($linkDB[1]['sticky']); 809 $this->assertTrue($linkDB[1]['sticky']);
814 } 810 }
811
812 /**
813 * Test updateMethodRemoveRedirector().
814 */
815 public function testUpdateRemoveRedirector()
816 {
817 $sandboxConf = 'sandbox/config';
818 copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
819 $this->conf = new ConfigManager($sandboxConf);
820 $updater = new Updater([], null, $this->conf, true);
821 $this->assertTrue($updater->updateMethodRemoveRedirector());
822 $this->assertFalse($this->conf->exists('redirector'));
823 $this->conf = new ConfigManager($sandboxConf);
824 $this->assertFalse($this->conf->exists('redirector'));
825 }
815} 826}