mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Allow execution of a test without a current controller. (from r111044)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112882 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fa5db43d76
commit
67b5116702
@ -134,7 +134,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
DataObject::reset();
|
||||
SiteTree::reset();
|
||||
Hierarchy::reset();
|
||||
Controller::curr()->setSession(new Session(array()));
|
||||
if(Controller::has_curr()) Controller::curr()->setSession(new Session(array()));
|
||||
|
||||
$this->originalTheme = SSViewer::current_theme();
|
||||
|
||||
@ -401,7 +401,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
// Stop the redirection that might have been requested in the test.
|
||||
// Note: Ideally a clean Controller should be created for each test.
|
||||
// Now all tests executed in a batch share the same controller.
|
||||
$controller = Controller::curr();
|
||||
$controller = Controller::has_curr() ? Controller::curr() : null;
|
||||
if ( $controller && $controller->response && $controller->response->getHeader('Location') ) {
|
||||
$controller->response->setStatusCode(200);
|
||||
$controller->response->removeHeader('Location');
|
||||
|
Loading…
Reference in New Issue
Block a user