Code Duplication    Length = 25-28 lines in 2 locations

tests/filesystem/FolderTest.php 1 location

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

tests/forms/uploadfield/UploadFieldTest.php 1 location

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