mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Checking for optional classes in 'cms' module in SapphireTest
This commit is contained in:
parent
1c213906cb
commit
6d18e38278
@ -128,18 +128,20 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
Member::set_password_validator(null);
|
||||
Cookie::set_report_errors(false);
|
||||
|
||||
RootURLController::reset();
|
||||
if(class_exists('RootURLController')) RootURLController::reset();
|
||||
if(class_exists('Translatable')) Translatable::reset();
|
||||
Versioned::reset();
|
||||
DataObject::reset();
|
||||
SiteTree::reset();
|
||||
if(class_exists('SiteTree')) SiteTree::reset();
|
||||
Hierarchy::reset();
|
||||
if(Controller::has_curr()) Controller::curr()->setSession(new Session(array()));
|
||||
|
||||
$this->originalTheme = SSViewer::current_theme();
|
||||
|
||||
// Save nested_urls state, so we can restore it later
|
||||
$this->originalNestedURLsState = SiteTree::nested_urls();
|
||||
if(class_exists('SiteTree')) {
|
||||
// Save nested_urls state, so we can restore it later
|
||||
$this->originalNestedURLsState = SiteTree::nested_urls();
|
||||
}
|
||||
|
||||
$className = get_class($this);
|
||||
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
||||
@ -393,11 +395,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
// Reset mocked datetime
|
||||
SS_Datetime::clear_mock_now();
|
||||
|
||||
// Restore nested_urls state
|
||||
if ( $this->originalNestedURLsState )
|
||||
SiteTree::enable_nested_urls();
|
||||
else
|
||||
SiteTree::disable_nested_urls();
|
||||
if(class_exists('SiteTree')) {
|
||||
// Restore nested_urls state
|
||||
if ( $this->originalNestedURLsState )
|
||||
SiteTree::enable_nested_urls();
|
||||
else
|
||||
SiteTree::disable_nested_urls();
|
||||
}
|
||||
|
||||
// Stop the redirection that might have been requested in the test.
|
||||
// Note: Ideally a clean Controller should be created for each test.
|
||||
|
Loading…
x
Reference in New Issue
Block a user