From 7dcbfde5ffbc057a44f710e3be7e4856d235e90b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 27 Feb 2017 20:20:53 +0100 Subject: Set the vintage theme by default for the time being --- tests/Updater/UpdaterTest.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'tests/Updater') diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 1d15cfaa..de330ae2 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php @@ -466,4 +466,44 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; unlink('sandbox/'. $theme .'/linklist.html'); rmdir('sandbox/'. $theme); } + + /** + * Test updateMethodDefaultThemeVintage with the default theme enabled. + */ + public function testSetDefaultThemeToVintage() + { + $sandboxConf = 'sandbox/config'; + copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); + $this->conf = new ConfigManager($sandboxConf); + + $this->conf->set('resource.theme', 'default'); + $updater = new Updater([], [], $this->conf, true); + $this->assertTrue($updater->updateMethodDefaultThemeVintage()); + $this->assertEquals('vintage', $this->conf->get('resource.theme')); + + // reload from file + $this->conf = new ConfigManager($sandboxConf); + $this->assertEquals('vintage', $this->conf->get('resource.theme')); + } + + /** + * Test updateMethodDefaultThemeVintage with custom theme enabled => nothing to do. + */ + public function testSetDefaultThemeNothingToDo() + { + $sandboxConf = 'sandbox/config'; + copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); + $this->conf = new ConfigManager($sandboxConf); + + $theme = 'myawesometheme'; + $this->conf->set('resource.theme', $theme); + $this->conf->write(true); + $updater = new Updater([], [], $this->conf, true); + $this->assertTrue($updater->updateMethodDefaultThemeVintage()); + $this->assertEquals($theme, $this->conf->get('resource.theme')); + + // reload from file + $this->conf = new ConfigManager($sandboxConf); + $this->assertEquals($theme, $this->conf->get('resource.theme')); + } } -- cgit v1.2.3