mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR #6083 FileTest doesn't remove test folders and files created during test (from r111903)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112943 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
31f0ceac07
commit
8222d72d39
@ -248,6 +248,8 @@ class FileTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
parent::tearDown();
|
||||
|
||||
/* Remove the test files that we've created */
|
||||
$fileIDs = $this->allFixtureIDs('File');
|
||||
foreach($fileIDs as $fileID) {
|
||||
@ -261,9 +263,11 @@ class FileTest extends SapphireTest {
|
||||
$folder = DataObject::get_by_id('Folder', $folderID);
|
||||
if($folder && file_exists(BASE_PATH."/$folder->Filename")) Filesystem::removeFolder(BASE_PATH."/$folder->Filename");
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
|
||||
// Remove left over folders and any files that may exist
|
||||
if(file_exists('../assets/FileTest')) Filesystem::removeFolder('../assets/FileTest');
|
||||
if(file_exists('../assets/FileTest-subfolder')) Filesystem::removeFolder('../assets/FileTest-subfolder');
|
||||
if(file_exists('../assets/FileTest.txt')) unlink('../assets/FileTest.txt');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user