From b9f8b83790a57b55f7d12471460537a268a24642 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 2 Aug 2016 12:54:55 +0200 Subject: Fix update method escapeUnescapedConfig * Actually run it * unit tests Fixes #611 --- tests/Updater/UpdaterTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/Updater') 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'); + } } -- cgit v1.2.3