diff options
Diffstat (limited to 'tests/Updater')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 24 |
1 files changed, 24 insertions, 0 deletions
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;'; | |||
263 | $expected = filemtime($this->conf->getConfigFileExt()); | 263 | $expected = filemtime($this->conf->getConfigFileExt()); |
264 | $this->assertEquals($expected, $filetime); | 264 | $this->assertEquals($expected, $filetime); |
265 | } | 265 | } |
266 | |||
267 | /** | ||
268 | * Test escapeUnescapedConfig with valid data. | ||
269 | */ | ||
270 | public function testEscapeConfig() | ||
271 | { | ||
272 | $sandbox = 'sandbox/config'; | ||
273 | copy(self::$configFile .'.json.php', $sandbox .'.json.php'); | ||
274 | $this->conf = new ConfigManager($sandbox); | ||
275 | $title = '<script>alert("title");</script>'; | ||
276 | $headerLink = '<script>alert("header_link");</script>'; | ||
277 | $redirectorUrl = '<script>alert("redirector");</script>'; | ||
278 | $this->conf->set('general.title', $title); | ||
279 | $this->conf->set('general.header_link', $headerLink); | ||
280 | $this->conf->set('redirector.url', $redirectorUrl); | ||
281 | $updater = new Updater(array(), array(), $this->conf, true); | ||
282 | $done = $updater->updateMethodEscapeUnescapedConfig(); | ||
283 | $this->assertTrue($done); | ||
284 | $this->conf->reload(); | ||
285 | $this->assertEquals(escape($title), $this->conf->get('general.title')); | ||
286 | $this->assertEquals(escape($headerLink), $this->conf->get('general.header_link')); | ||
287 | $this->assertEquals(escape($redirectorUrl), $this->conf->get('redirector.url')); | ||
288 | unlink($sandbox .'.json.php'); | ||
289 | } | ||
266 | } | 290 | } |