Skip to content
Snippets Groups Projects
Commit 89478a09 authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

Fix unit tests

parent 5334bcce
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
namespace OCA\DAV\Connector\Sabre;
use OC\Files\Mount\MoveableMount;
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
......@@ -234,7 +235,14 @@ abstract class Node implements \Sabre\DAV\INode {
*/
$mountpoint = $this->info->getMountPoint();
if (!($mountpoint instanceof MoveableMount)) {
$permissions |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE;
$mountpointpath = $mountpoint->getMountPoint();
if (substr($mountpointpath, -1) === '/') {
$mountpointpath = substr($mountpointpath, 0, -1);
}
if ($mountpointpath === $this->info->getPath()) {
$permissions |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE;
}
}
/*
......
......@@ -108,16 +108,19 @@ class Node extends \Test\TestCase {
*/
public function testSharePermissions($type, $permissions, $expected) {
$storage = $this->getMock('\OCP\Files\Storage');
$storage->method('getPermissions')->willReturn($permissions);
$mountpoint = $this->getMock('\OCP\Files\Mount\IMountPoint');
$mountpoint->method('getMountPoint')->willReturn('myPath');
$info = $this->getMockBuilder('\OC\Files\FileInfo')
->disableOriginalConstructor()
->setMethods(array('getStorage', 'getType'))
->setMethods(['getStorage', 'getType', 'getMountPoint'])
->getMock();
$info->method('getStorage')->willReturn($storage);
$info->method('getType')->willReturn($type);
$info->method('getMountPoint')->willReturn($mountpoint);
$view = $this->getMock('\OC\Files\View');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment