Permalink
Browse files

MINOR Ensuring assets/ folder is created before using it in FileLinkT…

…rackingTest (and using ASSETS_PATH constant instead of hardcoding it)
  • Loading branch information...
1 parent 15e9d08 commit 7a80e6d2ea083c125b93f37a8be1454023c4e447 @chillu chillu committed Dec 16, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 tests/model/FileLinkTrackingTest.php
@@ -10,19 +10,21 @@ function setUp() {
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);
}
}

0 comments on commit 7a80e6d

Please sign in to comment.