From 7a80e6d2ea083c125b93f37a8be1454023c4e447 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 16 Dec 2011 17:29:50 +0100 Subject: [PATCH] MINOR Ensuring assets/ folder is created before using it in FileLinkTrackingTest (and using ASSETS_PATH constant instead of hardcoding it) --- tests/model/FileLinkTrackingTest.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/model/FileLinkTrackingTest.php b/tests/model/FileLinkTrackingTest.php index 02cca40f..f0357dd9 100644 --- a/tests/model/FileLinkTrackingTest.php +++ b/tests/model/FileLinkTrackingTest.php @@ -10,19 +10,21 @@ class FileLinkTrackingTest extends SapphireTest { parent::setUp(); $this->logInWithPermission('ADMIN'); - $fh = fopen(Director::baseFolder() . '/assets/testscript-test-file.pdf', "w"); + if(!file_exists(ASSETS_PATH)) mkdir(ASSETS_PATH); + $fh = fopen(ASSETS_PATH . '/testscript-test-file.pdf', "w"); fwrite($fh, str_repeat('x',1000000)); fclose($fh); } + function tearDown() { parent::tearDown(); $testFiles = array( - '/assets/testscript-test-file.pdf', - '/assets/renamed-test-file.pdf', - '/assets/renamed-test-file-second-time.pdf', + '/testscript-test-file.pdf', + '/renamed-test-file.pdf', + '/renamed-test-file-second-time.pdf', ); foreach($testFiles as $file) { - if(file_exists(Director::baseFolder().$file)) unlink(Director::baseFolder().$file); + if(file_exists(ASSETS_PATH . $file)) unlink(ASSETS_PATH . $file); } }