diff options
author | Robin Appelman <robin@icewind.nl> | 2020-10-27 16:29:28 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-03-19 19:32:14 +0300 |
commit | fd29d77817190ee66f19d1c5f1d7990c4d6d20d8 (patch) | |
tree | 8cbdfbefd2f9ec259f2023faf4a7fa2566229c4a /tests | |
parent | 37c3930f72c2165f534f9b237167d836667bcfc8 (diff) |
expand 'path is already shared' error message
Signed-off-by: Robin Appelman <robin@icewind.nl>
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 e053f4eb2e8..12425683e71 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; @@ -1411,10 +1412,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); @@ -1431,13 +1433,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(); @@ -1451,6 +1456,7 @@ class ManagerTest extends \Test\TestCase { $share->setSharedWith('sharedWith') ->setNode($path) ->setShareOwner('shareOwner') + ->setSharedWithDisplayName('userName') ->setProviderId('foo') ->setId('bar'); @@ -1473,6 +1479,9 @@ class ManagerTest extends \Test\TestCase { ->with($path) ->willReturn([$share2]); + $path->method('getName') + ->willReturn('name2.txt'); + self::invokePrivate($this->manager, 'userCreateChecks', [$share]); } |