Set the vintage theme by default for the time being

This commit is contained in:
ArthurHoaro 2017-02-27 20:20:53 +01:00
parent 7040169069
commit 7dcbfde5ff
2 changed files with 54 additions and 0 deletions

View file

@ -324,6 +324,20 @@ public function updateMethodMoveUserCss()
return rename('inc/user.css', 'data/user.css');
}
/**
* While the new default theme is in an unstable state
* continue to use the vintage theme
*/
public function updateMethodDefaultThemeVintage()
{
if ($this->conf->get('resource.theme') !== 'default') {
return true;
}
$this->conf->set('resource.theme', 'vintage');
$this->conf->write($this->isLoggedIn);
return true;
}
}
/**

View file

@ -466,4 +466,44 @@ public function testDefaultThemeWithCustomTheme()
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'));
}
}