summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-16 10:22:49 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-16 10:22:49 +0100
commited6843e87b03aa7e2a631bd8b97085380023b4ba (patch)
tree46e9d8c1f1dc6b2b2ab282dd1e9130fdff9828e8 /tests
parent3837cb95fde8b1b89b037a5e1dee303b0fd3272c (diff)
downloadnextcloud-server-ed6843e87b03aa7e2a631bd8b97085380023b4ba.tar.gz
nextcloud-server-ed6843e87b03aa7e2a631bd8b97085380023b4ba.zip
Return proper error string if sharing for this user is disabled
Fixes #22402
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share20/managertest.php41
1 files changed, 10 insertions, 31 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php
index bb91ed0d51e..fe94b72c4e6 100644
--- a/tests/lib/share20/managertest.php
+++ b/tests/lib/share20/managertest.php
@@ -1404,28 +1404,21 @@ class ManagerTest extends \Test\TestCase {
->setMethods(['sharingDisabledForUser'])
->getMock();
- $manager->method('sharingDisabledForUser')->willReturn($disabledForUser);
+ $manager->method('sharingDisabledForUser')
+ ->with('user')
+ ->willReturn($disabledForUser);
- $user = $this->getMock('\OCP\IUser');
$share = $this->manager->newShare();
$share->setSharedBy('user');
- $res = $this->invokePrivate($manager, 'canShare', [$share]);
- $this->assertEquals($expected, $res);
- }
-
- /**
- * @expectedException Exception
- * @expectedExceptionMessage The Share API is disabled
- */
- public function testCreateShareCantShare() {
- $manager = $this->createManagerMock()
- ->setMethods(['canShare'])
- ->getMock();
+ $exception = false;
+ try {
+ $res = $this->invokePrivate($manager, 'canShare', [$share]);
+ } catch (\Exception $e) {
+ $exception = true;
+ }
- $manager->expects($this->once())->method('canShare')->willReturn(false);
- $share = $this->manager->newShare();
- $manager->createShare($share);
+ $this->assertEquals($expected, !$exception);
}
public function testCreateShareUser() {
@@ -1945,20 +1938,6 @@ class ManagerTest extends \Test\TestCase {
/**
* @expectedException Exception
- * @expectedExceptionMessage The Share API is disabled
- */
- public function testUpdateShareCantShare() {
- $manager = $this->createManagerMock()
- ->setMethods(['canShare'])
- ->getMock();
-
- $manager->expects($this->once())->method('canShare')->willReturn(false);
- $share = $this->manager->newShare();
- $manager->updateShare($share);
- }
-
- /**
- * @expectedException Exception
* @expectedExceptionMessage Can't change share type
*/
public function testUpdateShareCantChangeShareType() {