From 78ec32508e666d79253d6c8289c3ed7c0841c3f1 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Fri, 12 Feb 2010 02:31:05 +0000 Subject: [PATCH] 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 --- dev/SapphireTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 580f78579..8390eff14 100755 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -27,6 +27,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { protected $originalRequirements; protected $originalIsRunningTest; protected $originalTheme; + protected $originalNestedURLsState; protected $mailer; @@ -101,6 +102,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase { 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(); $className = get_class($this); $fixtureFile = eval("return {$className}::\$fixture_file;"); @@ -338,6 +342,12 @@ 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(); } /** * Clear the log of emails sent