diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-07-12 20:51:41 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-07-12 21:24:55 +0200 |
commit | 243df99fcfcd384a8ad4b54e89c6d621bb81685b (patch) | |
tree | be15c10c8bde8d2647f1d4bf5a5a5a856b8e1a69 /apps/files_sharing/tests | |
parent | 09d5b61c9e468cdc0b92db27946140e68192e2e5 (diff) | |
download | nextcloud-server-243df99fcfcd384a8ad4b54e89c6d621bb81685b.tar.gz nextcloud-server-243df99fcfcd384a8ad4b54e89c6d621bb81685b.zip |
Fix formatting of email and circle shares
Due to a misplaced "||" instead of "===" the condition was always met,
so every share type in the conditional chain after the remote and remote
group shares was formatted as a remote/remote group share.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 2c638fe4ed6..4a2c486765f 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -2088,6 +2088,47 @@ class ShareAPIControllerTest extends TestCase { [], $share, [], true ]; + $share = \OC::$server->getShareManager()->newShare(); + $share->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setSharedBy('initiator') + ->setSharedWith('user@server.com') + ->setShareOwner('owner') + ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setNode($folder) + ->setShareTime(new \DateTime('2000-01-01T00:01:02')) + ->setTarget('myTarget') + ->setId(42) + ->setPassword('password'); + + $result[] = [ + [ + 'id' => 42, + 'share_type' => \OCP\Share::SHARE_TYPE_EMAIL, + 'uid_owner' => 'initiator', + 'displayname_owner' => 'initiator', + 'permissions' => 1, + 'stime' => 946684862, + 'parent' => null, + 'expiration' => null, + 'token' => null, + 'uid_file_owner' => 'owner', + 'displayname_file_owner' => 'owner', + 'path' => 'folder', + 'item_type' => 'folder', + 'storage_id' => 'storageId', + 'storage' => 100, + 'item_source' => 2, + 'file_source' => 2, + 'file_parent' => 1, + 'file_target' => 'myTarget', + 'share_with' => 'user@server.com', + 'share_with_displayname' => 'mail display name', + 'mail_send' => 0, + 'mimetype' => 'myFolderMimeType', + 'password' => 'password' + ], $share, [], false + ]; + return $result; } @@ -2131,15 +2172,28 @@ class ShareAPIControllerTest extends TestCase { $this->overwriteService(\OCP\Contacts\IManager::class, $cm); $cm->method('search') - ->with('user@server.com', ['CLOUD']) - ->willReturn([ - [ - 'CLOUD' => [ - 'user@server.com', + ->will($this->returnValueMap([ + ['user@server.com', ['CLOUD'], [], + [ + [ + 'CLOUD' => [ + 'user@server.com', + ], + 'FN' => 'foobar', + ], ], - 'FN' => 'foobar', ], - ]); + ['user@server.com', ['EMAIL'], [], + [ + [ + 'EMAIL' => [ + 'user@server.com', + ], + 'FN' => 'mail display name', + ], + ], + ], + ])); try { $result = $this->invokePrivate($this->ocs, 'formatShare', [$share]); |