diff --git a/dev/DevelopmentAdmin.php b/dev/DevelopmentAdmin.php index 92b272279..86345705b 100644 --- a/dev/DevelopmentAdmin.php +++ b/dev/DevelopmentAdmin.php @@ -19,6 +19,8 @@ class DevelopmentAdmin extends Controller { function init() { parent::init(); + BasicAuth::requireLogin('ADMIN', "SilverStripe Developer Access"); + // 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. $canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN")); diff --git a/dev/FunctionalTest.php b/dev/FunctionalTest.php index 04e83aa32..d906a3347 100644 --- a/dev/FunctionalTest.php +++ b/dev/FunctionalTest.php @@ -42,8 +42,6 @@ class FunctionalTest extends SapphireTest { */ protected $cssParser = null; - private $originalTheme = null; - /** * 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 @@ -63,10 +61,7 @@ class FunctionalTest extends SapphireTest { $this->mainSession = new TestSession(); // Disable theme, if necessary - if($this->stat('disable_themes')) { - $this->originalTheme = SSViewer::current_theme(); - SSViewer::set_theme(null); - } + if($this->stat('disable_themes')) SSViewer::set_theme(null); // Switch to draft site, if necessary if($this->stat('use_draft_site')) { @@ -77,11 +72,6 @@ class FunctionalTest extends SapphireTest { function tearDown() { parent::tearDown(); unset($this->mainSession); - - // Re-enable theme, if previously disabled - if($this->stat('disable_themes')) { - SSViewer::set_theme($this->originalTheme); - } } /** diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 7316c710c..e4eede1a4 100755 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -33,6 +33,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { protected $originalMemberPasswordValidator; protected $originalRequirements; protected $originalIsRunningTest; + protected $originalTheme; protected $mailer; @@ -106,6 +107,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase { SiteTree::reset(); Hierarchy::reset(); Controller::curr()->setSession(new Session(array())); + + $this->originalTheme = SSViewer::current_theme(); $className = get_class($this); $fixtureFile = eval("return {$className}::\$fixture_file;"); @@ -338,6 +341,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase { self::$is_running_test = $this->originalIsRunningTest; $this->originalIsRunningTest = null; + // Reset theme setting + SSViewer::set_theme($this->originalTheme); + // Reset mocked datetime SS_Datetime::clear_mock_now(); }