diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2021-03-19 13:39:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 13:39:22 +0100 |
commit | 12868487312fa2d153fdebc7592ab54dcaf2c419 (patch) | |
tree | 2721edc1d8f5b2beed882b818cb5ecfff4069bf7 /tests | |
parent | 086cf56b21e6b3506cc628acc94ef3ccbb2c9de0 (diff) | |
parent | a55064970835b790ed6c9dfe865e655b9d76694b (diff) | |
download | nextcloud-server-12868487312fa2d153fdebc7592ab54dcaf2c419.tar.gz nextcloud-server-12868487312fa2d153fdebc7592ab54dcaf2c419.zip |
Merge pull request #23718 from nextcloud/already-shared-error-message
expand 'path is already shared' error message
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index fefbbc2b2ae..c70887ec87d 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -50,6 +50,7 @@ use OCP\Mail\IMailer; use OCP\Security\Events\ValidatePasswordPolicyEvent; use OCP\Security\IHasher; use OCP\Security\ISecureRandom; +use OCP\Share\Exceptions\AlreadySharedException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IProviderFactory; use OCP\Share\IShare; @@ -1415,10 +1416,11 @@ class ManagerTest extends \Test\TestCase { public function testUserCreateChecksIdenticalShareExists() { - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Path is already shared with this user'); + $this->expectException(AlreadySharedException::class); + $this->expectExceptionMessage('Sharing name.txt failed, because this item is already shared with user user'); $share = $this->manager->newShare(); + $share->setSharedWithDisplayName('user'); $share2 = $this->manager->newShare(); $sharedWith = $this->createMock(IUser::class); @@ -1435,13 +1437,16 @@ class ManagerTest extends \Test\TestCase { ->with($path) ->willReturn([$share2]); + $path->method('getName') + ->willReturn('name.txt'); + self::invokePrivate($this->manager, 'userCreateChecks', [$share]); } public function testUserCreateChecksIdenticalPathSharedViaGroup() { - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Path is already shared with this user'); + $this->expectException(AlreadySharedException::class); + $this->expectExceptionMessage('Sharing name2.txt failed, because this item is already shared with user userName'); $share = $this->manager->newShare(); @@ -1455,6 +1460,7 @@ class ManagerTest extends \Test\TestCase { $share->setSharedWith('sharedWith') ->setNode($path) ->setShareOwner('shareOwner') + ->setSharedWithDisplayName('userName') ->setProviderId('foo') ->setId('bar'); @@ -1477,6 +1483,9 @@ class ManagerTest extends \Test\TestCase { ->with($path) ->willReturn([$share2]); + $path->method('getName') + ->willReturn('name2.txt'); + self::invokePrivate($this->manager, 'userCreateChecks', [$share]); } |