mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Use Config nesting in SapphireTest::useTestTheme()
Using the Config nesting functionality to restore variables
This commit is contained in:
parent
612a096765
commit
5298371282
@ -895,13 +895,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
* @param $callback Closure
|
||||
*/
|
||||
protected function useTestTheme($themeBaseDir, $theme, $callback) {
|
||||
Config::nest();
|
||||
global $project;
|
||||
|
||||
$manifest = new SS_TemplateManifest($themeBaseDir, $project, true, true);
|
||||
|
||||
SS_TemplateLoader::instance()->pushManifest($manifest);
|
||||
|
||||
$origTheme = Config::inst()->get('SSViewer', 'theme');
|
||||
Config::inst()->update('SSViewer', 'theme', $theme);
|
||||
|
||||
$e = null;
|
||||
@ -911,7 +911,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
// Remove all the test themes we created
|
||||
SS_TemplateLoader::instance()->popManifest();
|
||||
Config::inst()->update('SSViewer', 'theme', $origTheme);
|
||||
|
||||
Config::unnest();
|
||||
|
||||
if ($e) throw $e;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user