mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: Preserve theme settings in tests (from r97920)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102555 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6c0efa68de
commit
7c84bb984e
@ -19,6 +19,8 @@ class DevelopmentAdmin extends Controller {
|
|||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
BasicAuth::requireLogin('ADMIN', "SilverStripe Developer Access");
|
||||||
|
|
||||||
// We allow access to this controller regardless of live-status or ADMIN permission only
|
// We allow access to this controller regardless of live-status or ADMIN permission only
|
||||||
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
||||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
@ -42,8 +42,6 @@ class FunctionalTest extends SapphireTest {
|
|||||||
*/
|
*/
|
||||||
protected $cssParser = null;
|
protected $cssParser = null;
|
||||||
|
|
||||||
private $originalTheme = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is true, then 30x Location headers will be automatically followed.
|
* If this is true, then 30x Location headers will be automatically followed.
|
||||||
* If not, then you will have to manaully call $this->mainSession->followRedirection() to follow them. However, this will let you inspect
|
* If not, then you will have to manaully call $this->mainSession->followRedirection() to follow them. However, this will let you inspect
|
||||||
@ -63,10 +61,7 @@ class FunctionalTest extends SapphireTest {
|
|||||||
$this->mainSession = new TestSession();
|
$this->mainSession = new TestSession();
|
||||||
|
|
||||||
// Disable theme, if necessary
|
// Disable theme, if necessary
|
||||||
if($this->stat('disable_themes')) {
|
if($this->stat('disable_themes')) SSViewer::set_theme(null);
|
||||||
$this->originalTheme = SSViewer::current_theme();
|
|
||||||
SSViewer::set_theme(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Switch to draft site, if necessary
|
// Switch to draft site, if necessary
|
||||||
if($this->stat('use_draft_site')) {
|
if($this->stat('use_draft_site')) {
|
||||||
@ -77,11 +72,6 @@ class FunctionalTest extends SapphireTest {
|
|||||||
function tearDown() {
|
function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
unset($this->mainSession);
|
unset($this->mainSession);
|
||||||
|
|
||||||
// Re-enable theme, if previously disabled
|
|
||||||
if($this->stat('disable_themes')) {
|
|
||||||
SSViewer::set_theme($this->originalTheme);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
protected $originalMemberPasswordValidator;
|
protected $originalMemberPasswordValidator;
|
||||||
protected $originalRequirements;
|
protected $originalRequirements;
|
||||||
protected $originalIsRunningTest;
|
protected $originalIsRunningTest;
|
||||||
|
protected $originalTheme;
|
||||||
|
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
@ -106,6 +107,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
SiteTree::reset();
|
SiteTree::reset();
|
||||||
Hierarchy::reset();
|
Hierarchy::reset();
|
||||||
Controller::curr()->setSession(new Session(array()));
|
Controller::curr()->setSession(new Session(array()));
|
||||||
|
|
||||||
|
$this->originalTheme = SSViewer::current_theme();
|
||||||
|
|
||||||
$className = get_class($this);
|
$className = get_class($this);
|
||||||
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
||||||
@ -338,6 +341,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
self::$is_running_test = $this->originalIsRunningTest;
|
self::$is_running_test = $this->originalIsRunningTest;
|
||||||
$this->originalIsRunningTest = null;
|
$this->originalIsRunningTest = null;
|
||||||
|
|
||||||
|
// Reset theme setting
|
||||||
|
SSViewer::set_theme($this->originalTheme);
|
||||||
|
|
||||||
// Reset mocked datetime
|
// Reset mocked datetime
|
||||||
SS_Datetime::clear_mock_now();
|
SS_Datetime::clear_mock_now();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user