| @@ 15-39 (lines=25) @@ | ||
| 12 | ||
| 13 | protected static $fixture_file = 'FileTest.yml'; |
|
| 14 | ||
| 15 | public function setUp() { |
|
| 16 | parent::setUp(); |
|
| 17 | ||
| 18 | $this->logInWithPermission('ADMIN'); |
|
| 19 | Versioned::set_stage(Versioned::DRAFT); |
|
| 20 | ||
| 21 | // Set backend root to /FolderTest |
|
| 22 | AssetStoreTest_SpyStore::activate('FolderTest'); |
|
| 23 | ||
| 24 | // Create a test folders for each of the fixture references |
|
| 25 | foreach(Folder::get() as $folder) { |
|
| 26 | $path = AssetStoreTest_SpyStore::getLocalPath($folder); |
|
| 27 | SS_Filesystem::makeFolder($path); |
|
| 28 | } |
|
| 29 | ||
| 30 | // Create a test files for each of the fixture references |
|
| 31 | $files = File::get()->exclude('ClassName', 'Folder'); |
|
| 32 | foreach($files as $file) { |
|
| 33 | $path = AssetStoreTest_SpyStore::getLocalPath($file); |
|
| 34 | SS_Filesystem::makeFolder(dirname($path)); |
|
| 35 | $fh = fopen($path, "w+"); |
|
| 36 | fwrite($fh, str_repeat('x', 1000000)); |
|
| 37 | fclose($fh); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | public function tearDown() { |
|
| 42 | AssetStoreTest_SpyStore::reset(); |
|
| @@ 19-46 (lines=28) @@ | ||
| 16 | ||
| 17 | protected $oldReadingMode = null; |
|
| 18 | ||
| 19 | public function setUp() { |
|
| 20 | parent::setUp(); |
|
| 21 | ||
| 22 | $this->loginWithPermission('ADMIN'); |
|
| 23 | ||
| 24 | // Save versioned state |
|
| 25 | $this->oldReadingMode = Versioned::get_reading_mode(); |
|
| 26 | Versioned::set_stage(Versioned::DRAFT); |
|
| 27 | ||
| 28 | // Set backend root to /UploadFieldTest |
|
| 29 | AssetStoreTest_SpyStore::activate('UploadFieldTest'); |
|
| 30 | ||
| 31 | // Create a test folders for each of the fixture references |
|
| 32 | foreach(Folder::get() as $folder) { |
|
| 33 | $path = AssetStoreTest_SpyStore::getLocalPath($folder); |
|
| 34 | Filesystem::makeFolder($path); |
|
| 35 | } |
|
| 36 | ||
| 37 | // Create a test files for each of the fixture references |
|
| 38 | $files = File::get()->exclude('ClassName', 'Folder'); |
|
| 39 | foreach($files as $file) { |
|
| 40 | $path = AssetStoreTest_SpyStore::getLocalPath($file); |
|
| 41 | Filesystem::makeFolder(dirname($path)); |
|
| 42 | $fh = fopen($path, "w+"); |
|
| 43 | fwrite($fh, str_repeat('x', 1000000)); |
|
| 44 | fclose($fh); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | public function tearDown() { |
|
| 49 | AssetStoreTest_SpyStore::reset(); |
|