|
@@ 447-459 (lines=13) @@
|
| 444 |
|
$this->moveBetweenStorages($storage1, $storage2); |
| 445 |
|
} |
| 446 |
|
|
| 447 |
|
function moveBetweenStorages($storage1, $storage2) { |
| 448 |
|
\OC\Files\Filesystem::mount($storage1, array(), '/'); |
| 449 |
|
\OC\Files\Filesystem::mount($storage2, array(), '/substorage'); |
| 450 |
|
|
| 451 |
|
$rootView = new \OC\Files\View(''); |
| 452 |
|
$rootView->rename('foo.txt', 'substorage/folder/foo.txt'); |
| 453 |
|
$this->assertFalse($rootView->file_exists('foo.txt')); |
| 454 |
|
$this->assertTrue($rootView->file_exists('substorage/folder/foo.txt')); |
| 455 |
|
$rootView->rename('substorage/folder', 'anotherfolder'); |
| 456 |
|
$this->assertFalse($rootView->is_dir('substorage/folder')); |
| 457 |
|
$this->assertTrue($rootView->file_exists('anotherfolder/foo.txt')); |
| 458 |
|
$this->assertTrue($rootView->file_exists('anotherfolder/bar.txt')); |
| 459 |
|
} |
| 460 |
|
|
| 461 |
|
/** |
| 462 |
|
* @medium |
|
@@ 510-524 (lines=15) @@
|
| 507 |
|
/** |
| 508 |
|
* @medium |
| 509 |
|
*/ |
| 510 |
|
public function testUnlinkRootMustFail() { |
| 511 |
|
$storage1 = $this->getTestStorage(); |
| 512 |
|
$storage2 = $this->getTestStorage(); |
| 513 |
|
\OC\Files\Filesystem::mount($storage1, array(), '/'); |
| 514 |
|
\OC\Files\Filesystem::mount($storage2, array(), '/substorage'); |
| 515 |
|
|
| 516 |
|
$rootView = new \OC\Files\View(''); |
| 517 |
|
$rootView->file_put_contents('/foo.txt', 'asd'); |
| 518 |
|
$rootView->file_put_contents('/substorage/bar.txt', 'asd'); |
| 519 |
|
|
| 520 |
|
$this->assertFalse($rootView->unlink('')); |
| 521 |
|
$this->assertFalse($rootView->unlink('/')); |
| 522 |
|
$this->assertFalse($rootView->unlink('substorage')); |
| 523 |
|
$this->assertFalse($rootView->unlink('/substorage')); |
| 524 |
|
} |
| 525 |
|
|
| 526 |
|
/** |
| 527 |
|
* @medium |