Code Duplication    Length = 13-15 lines in 2 locations

tests/lib/files/view.php 2 locations

@@ 387-399 (lines=13) @@
384
		$this->moveBetweenStorages($storage1, $storage2);
385
	}
386
387
	function moveBetweenStorages($storage1, $storage2) {
388
		\OC\Files\Filesystem::mount($storage1, array(), '/');
389
		\OC\Files\Filesystem::mount($storage2, array(), '/substorage');
390
391
		$rootView = new \OC\Files\View('');
392
		$rootView->rename('foo.txt', 'substorage/folder/foo.txt');
393
		$this->assertFalse($rootView->file_exists('foo.txt'));
394
		$this->assertTrue($rootView->file_exists('substorage/folder/foo.txt'));
395
		$rootView->rename('substorage/folder', 'anotherfolder');
396
		$this->assertFalse($rootView->is_dir('substorage/folder'));
397
		$this->assertTrue($rootView->file_exists('anotherfolder/foo.txt'));
398
		$this->assertTrue($rootView->file_exists('anotherfolder/bar.txt'));
399
	}
400
401
	/**
402
	 * @medium
@@ 427-441 (lines=15) @@
424
	/**
425
	 * @medium
426
	 */
427
	function testUnlinkRootMustFail() {
428
		$storage1 = $this->getTestStorage();
429
		$storage2 = $this->getTestStorage();
430
		\OC\Files\Filesystem::mount($storage1, array(), '/');
431
		\OC\Files\Filesystem::mount($storage2, array(), '/substorage');
432
433
		$rootView = new \OC\Files\View('');
434
		$rootView->file_put_contents('/foo.txt', 'asd');
435
		$rootView->file_put_contents('/substorage/bar.txt', 'asd');
436
437
		$this->assertFalse($rootView->unlink(''));
438
		$this->assertFalse($rootView->unlink('/'));
439
		$this->assertFalse($rootView->unlink('substorage'));
440
		$this->assertFalse($rootView->unlink('/substorage'));
441
	}
442
443
	/**
444
	 * @medium