|
|
@ -306,6 +306,48 @@ class View extends \PHPUnit_Framework_TestCase { |
|
|
|
$this->assertTrue($rootView->file_exists('anotherfolder/bar.txt')); |
|
|
|
$this->assertTrue($rootView->file_exists('anotherfolder/bar.txt')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @medium |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function testUnlink() { |
|
|
|
|
|
|
|
$storage1 = $this->getTestStorage(); |
|
|
|
|
|
|
|
$storage2 = $this->getTestStorage(); |
|
|
|
|
|
|
|
\OC\Files\Filesystem::mount($storage1, array(), '/'); |
|
|
|
|
|
|
|
\OC\Files\Filesystem::mount($storage2, array(), '/substorage'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootView = new \OC\Files\View(''); |
|
|
|
|
|
|
|
$rootView->file_put_contents('/foo.txt', 'asd'); |
|
|
|
|
|
|
|
$rootView->file_put_contents('/substorage/bar.txt', 'asd'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($rootView->file_exists('foo.txt')); |
|
|
|
|
|
|
|
$this->assertTrue($rootView->file_exists('substorage/bar.txt')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($rootView->unlink('foo.txt')); |
|
|
|
|
|
|
|
$this->assertTrue($rootView->unlink('substorage/bar.txt')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertFalse($rootView->file_exists('foo.txt')); |
|
|
|
|
|
|
|
$this->assertFalse($rootView->file_exists('substorage/bar.txt')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @medium |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function testUnlinkRootMustFail() { |
|
|
|
|
|
|
|
$storage1 = $this->getTestStorage(); |
|
|
|
|
|
|
|
$storage2 = $this->getTestStorage(); |
|
|
|
|
|
|
|
\OC\Files\Filesystem::mount($storage1, array(), '/'); |
|
|
|
|
|
|
|
\OC\Files\Filesystem::mount($storage2, array(), '/substorage'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootView = new \OC\Files\View(''); |
|
|
|
|
|
|
|
$rootView->file_put_contents('/foo.txt', 'asd'); |
|
|
|
|
|
|
|
$rootView->file_put_contents('/substorage/bar.txt', 'asd'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertFalse($rootView->unlink('')); |
|
|
|
|
|
|
|
$this->assertFalse($rootView->unlink('/')); |
|
|
|
|
|
|
|
$this->assertFalse($rootView->unlink('substorage')); |
|
|
|
|
|
|
|
$this->assertFalse($rootView->unlink('/substorage')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @medium |
|
|
|
* @medium |
|
|
|
*/ |
|
|
|
*/ |
|
|
|