MINOR Fixed SSViewerTest->testCurrentTheme() not to rely on SiteConfig

This commit is contained in:
Paul Meyrick 2011-03-18 15:04:43 +13:00 committed by Ingo Schommer
parent eb221ca821
commit 251c1df63a

View File

@ -8,26 +8,9 @@ class SSViewerTest extends SapphireTest {
* when no user themes are defined. * when no user themes are defined.
*/ */
function testCurrentTheme() { function testCurrentTheme() {
$config = SiteConfig::current_site_config(); //TODO: SiteConfig moved to CMS
$oldTheme = $config->Theme;
$config->Theme = '';
$config->write();
SSViewer::set_theme('mytheme'); SSViewer::set_theme('mytheme');
$this->assertEquals('mytheme', SSViewer::current_theme(), 'Current theme is the default - user has not defined one'); $this->assertEquals('mytheme', SSViewer::current_theme(), 'Current theme is the default - user has not defined one');
$config->Theme = 'myusertheme';
$config->write();
// Pretent to load the page
$c = new ContentController();
$c->handleRequest(new SS_HTTPRequest('GET', '/'));
$this->assertEquals('myusertheme', SSViewer::current_theme(), 'Current theme is a user defined one');
// Set the theme back to the original
$config->Theme = $oldTheme;
$config->write();
} }
/** /**
@ -592,3 +575,8 @@ class SSViewerTest_ViewableData extends ViewableData implements TestOnly {
return "arg1:{$arg1},arg2:{$arg2}"; return "arg1:{$arg1},arg2:{$arg2}";
} }
} }
class SSViewerTest_Controller extends Controller {
}