Skip to content

Commit

Permalink
MINOR Ensuring assets/ folder is created before using it in FileLinkT…
Browse files Browse the repository at this point in the history
…rackingTest (and using ASSETS_PATH constant instead of hardcoding it)
  • Loading branch information
chillu committed Dec 16, 2011
1 parent 15e9d08 commit 7a80e6d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/model/FileLinkTrackingTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ function setUp() {
parent::setUp(); parent::setUp();
$this->logInWithPermission('ADMIN'); $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)); fwrite($fh, str_repeat('x',1000000));
fclose($fh); fclose($fh);
} }

function tearDown() { function tearDown() {
parent::tearDown(); parent::tearDown();
$testFiles = array( $testFiles = array(
'/assets/testscript-test-file.pdf', '/testscript-test-file.pdf',
'/assets/renamed-test-file.pdf', '/renamed-test-file.pdf',
'/assets/renamed-test-file-second-time.pdf', '/renamed-test-file-second-time.pdf',
); );
foreach($testFiles as $file) { foreach($testFiles as $file) {
if(file_exists(Director::baseFolder().$file)) unlink(Director::baseFolder().$file); if(file_exists(ASSETS_PATH . $file)) unlink(ASSETS_PATH . $file);
} }
} }


Expand Down

0 comments on commit 7a80e6d

Please sign in to comment.