mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3094 from dhensby/patch-3
Use Config nesting in `SapphireTest::useTestTheme()`
This commit is contained in:
commit
a0a2aac6df
@ -962,13 +962,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
* @param $callback Closure
|
* @param $callback Closure
|
||||||
*/
|
*/
|
||||||
protected function useTestTheme($themeBaseDir, $theme, $callback) {
|
protected function useTestTheme($themeBaseDir, $theme, $callback) {
|
||||||
|
Config::nest();
|
||||||
global $project;
|
global $project;
|
||||||
|
|
||||||
$manifest = new SS_TemplateManifest($themeBaseDir, $project, true, true);
|
$manifest = new SS_TemplateManifest($themeBaseDir, $project, true, true);
|
||||||
|
|
||||||
SS_TemplateLoader::instance()->pushManifest($manifest);
|
SS_TemplateLoader::instance()->pushManifest($manifest);
|
||||||
|
|
||||||
$origTheme = Config::inst()->get('SSViewer', 'theme');
|
|
||||||
Config::inst()->update('SSViewer', 'theme', $theme);
|
Config::inst()->update('SSViewer', 'theme', $theme);
|
||||||
|
|
||||||
$e = null;
|
$e = null;
|
||||||
@ -978,7 +978,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
// Remove all the test themes we created
|
// Remove all the test themes we created
|
||||||
SS_TemplateLoader::instance()->popManifest();
|
SS_TemplateLoader::instance()->popManifest();
|
||||||
Config::inst()->update('SSViewer', 'theme', $origTheme);
|
|
||||||
|
Config::unnest();
|
||||||
|
|
||||||
if ($e) throw $e;
|
if ($e) throw $e;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user