diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-26 09:21:32 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-26 09:21:32 +0200 |
commit | e5a111b80e20b188efe782c8245d2379596f893c (patch) | |
tree | 45d30728be3213aa19a7bdff65860ba31b87b4e3 /tests | |
parent | 16319379905b2a8d52d182f7361864135408d622 (diff) | |
parent | 10c350b8955a318d9b2e50714f22bdfab06abf87 (diff) | |
download | nextcloud-server-e5a111b80e20b188efe782c8245d2379596f893c.tar.gz nextcloud-server-e5a111b80e20b188efe782c8245d2379596f893c.zip |
Merge pull request #11285 from owncloud/dav-permissions-create
Fix dav permissions for folders
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/connector/sabre/node.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/lib/connector/sabre/node.php b/tests/lib/connector/sabre/node.php new file mode 100644 index 00000000000..0f303457248 --- /dev/null +++ b/tests/lib/connector/sabre/node.php @@ -0,0 +1,55 @@ +<?php + +/** + * Copyright (c) 2014 Thomas Müller <thomas.mueller@tmit.eu> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test\Connector\Sabre; + +use OC\Files\FileInfo; +use OC\Files\View; + +class Node extends \PHPUnit_Framework_TestCase { + public function davPermissionsProvider() { + return array( + array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'), + array(\OCP\PERMISSION_ALL, 'dir', false, false, 'RDNVCK'), + array(\OCP\PERMISSION_ALL, 'file', true, false, 'SRDNVW'), + array(\OCP\PERMISSION_ALL, 'file', true, true, 'SRMDNVW'), + array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_SHARE, 'file', true, false, 'SDNVW'), + array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_UPDATE, 'file', false, false, 'RDNV'), + array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_DELETE, 'file', false, false, 'RW'), + array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'file', false, false, 'RDNVW'), + array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'dir', false, false, 'RDNV'), + ); + } + + /** + * @dataProvider davPermissionsProvider + */ + public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { + $info = $this->getMockBuilder('\OC\Files\FileInfo') + ->disableOriginalConstructor() + ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType')) + ->getMock(); + $info->expects($this->any()) + ->method('getPermissions') + ->will($this->returnValue($permissions)); + $info->expects($this->any()) + ->method('isShared') + ->will($this->returnValue($shared)); + $info->expects($this->any()) + ->method('isMounted') + ->will($this->returnValue($mounted)); + $info->expects($this->any()) + ->method('getType') + ->will($this->returnValue($type)); + $view = $this->getMock('\OC\Files\View'); + + $node = new \OC_Connector_Sabre_File($view, $info); + $this->assertEquals($expected, $node->getDavPermissions()); + } +} |