X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FUpdater%2FUpdaterTest.php;h=0d0ad92220cac1fef8fc954e645066854c7f555a;hb=e6c7e336637f82b1073b63f3cc6c8887c37c647f;hp=6bdce08b2c77c385f2f5c385c1eb3869c43ae86d;hpb=894a3c4bf38d8dcadb6941049b9167e5101805bd;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 6bdce08b..0d0ad922 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php @@ -263,4 +263,28 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $expected = filemtime($this->conf->getConfigFileExt()); $this->assertEquals($expected, $filetime); } + + /** + * Test escapeUnescapedConfig with valid data. + */ + public function testEscapeConfig() + { + $sandbox = 'sandbox/config'; + copy(self::$configFile .'.json.php', $sandbox .'.json.php'); + $this->conf = new ConfigManager($sandbox); + $title = ''; + $headerLink = ''; + $redirectorUrl = ''; + $this->conf->set('general.title', $title); + $this->conf->set('general.header_link', $headerLink); + $this->conf->set('redirector.url', $redirectorUrl); + $updater = new Updater(array(), array(), $this->conf, true); + $done = $updater->updateMethodEscapeUnescapedConfig(); + $this->assertTrue($done); + $this->conf->reload(); + $this->assertEquals(escape($title), $this->conf->get('general.title')); + $this->assertEquals(escape($headerLink), $this->conf->get('general.header_link')); + $this->assertEquals(escape($redirectorUrl), $this->conf->get('redirector.url')); + unlink($sandbox .'.json.php'); + } }