mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: restore the original nested_urls state after running the test, so we can enable and disable nested URLs within the tests safely.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98860 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
331c747fce
commit
78ec32508e
@ -27,6 +27,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
protected $originalRequirements;
|
protected $originalRequirements;
|
||||||
protected $originalIsRunningTest;
|
protected $originalIsRunningTest;
|
||||||
protected $originalTheme;
|
protected $originalTheme;
|
||||||
|
protected $originalNestedURLsState;
|
||||||
|
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
@ -102,6 +103,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$this->originalTheme = SSViewer::current_theme();
|
$this->originalTheme = SSViewer::current_theme();
|
||||||
|
|
||||||
|
// Save nested_urls state, so we can restore it later
|
||||||
|
$this->originalNestedURLsState = SiteTree::nested_urls();
|
||||||
|
|
||||||
$className = get_class($this);
|
$className = get_class($this);
|
||||||
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
||||||
|
|
||||||
@ -338,6 +342,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
// Reset mocked datetime
|
// Reset mocked datetime
|
||||||
SS_Datetime::clear_mock_now();
|
SS_Datetime::clear_mock_now();
|
||||||
|
|
||||||
|
// Restore nested_urls state
|
||||||
|
if ( $this->originalNestedURLsState )
|
||||||
|
SiteTree::enable_nested_urls();
|
||||||
|
else
|
||||||
|
SiteTree::disable_nested_urls();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Clear the log of emails sent
|
* Clear the log of emails sent
|
||||||
|
Loading…
Reference in New Issue
Block a user