From dd92459517d66bd990e82c0b4ed18b9b15f314b7 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 19 Oct 2010 04:52:46 +0000 Subject: [PATCH] MINOR CoreTest::testGetTempPathInProject() will try to create a temp dirs when running. CoreTest::tearDown() will now remove these temp dirs when the test finishes (from r111748) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112919 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/CoreTest.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/CoreTest.php b/tests/CoreTest.php index 330ce7d28..d1be47382 100644 --- a/tests/CoreTest.php +++ b/tests/CoreTest.php @@ -13,7 +13,7 @@ class CoreTest extends SapphireTest { public function setUp() { parent::setUp(); - $this->tempPath = $tempPath = Director::baseFolder() . '/silverstripe-cache'; + $this->tempPath = Director::baseFolder() . '/silverstripe-cache'; } public function testGetTempPathInProject() { @@ -22,7 +22,7 @@ class CoreTest extends SapphireTest { } else { // A typical Windows location for where sites are stored on IIS $this->assertEquals(getTempFolder('C:\\inetpub\\wwwroot\\silverstripe'), getSysTempDir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe'); - + // A typical Mac OS X location for where sites are stored $this->assertEquals(getTempFolder('/Users/joebloggs/Sites/silverstripe'), getSysTempDir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe'); @@ -31,4 +31,17 @@ class CoreTest extends SapphireTest { } } + public function tearDown() { + parent::tearDown(); + if(file_exists(getSysTempDir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe')) { + rmdir(getSysTempDir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe'); + } + if(file_exists(getSysTempDir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe')) { + rmdir(getSysTempDir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe'); + } + if(file_exists(getSysTempDir() . '/silverstripe-cache-var-www-silverstripe')) { + rmdir(getSysTempDir() . '/silverstripe-cache-var-www-silverstripe'); + } + } + } \ No newline at end of file