mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Ensuring assets/ folder is created before using it in FileLinkTrackingTest (and using ASSETS_PATH constant instead of hardcoding it)
This commit is contained in:
parent
15e9d08eaa
commit
7a80e6d2ea
@ -10,19 +10,21 @@ class FileLinkTrackingTest extends SapphireTest {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user