]> source.dussan.org Git - nextcloud-server.git/commitdiff
adjust unit tests
authorBjoern Schiessle <bjoern@schiessle.org>
Wed, 31 Oct 2018 19:10:05 +0000 (20:10 +0100)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 1 Nov 2018 03:27:25 +0000 (04:27 +0100)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
apps/files_sharing/tests/Controller/ShareAPIControllerTest.php

index bd263de3f625091f9c643cf18dd3975055c7f1e8..eb39dd7926fa1174432140595d0b956543dc3a07 100644 (file)
@@ -253,7 +253,7 @@ class ShareAPIControllerTest extends TestCase {
 
        public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
                                                                $shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token=null,
-                                                               $password=null) {
+                                                               $password=null, $label = '') {
                $share = $this->getMockBuilder(IShare::class)->getMock();
                $share->method('getId')->willReturn($id);
                $share->method('getShareType')->willReturn($shareType);
@@ -263,6 +263,7 @@ class ShareAPIControllerTest extends TestCase {
                $share->method('getNode')->willReturn($path);
                $share->method('getPermissions')->willReturn($permissions);
                $share->method('getNote')->willReturn($note);
+               $share->method('getLabel')->willReturn($label);
                $time = new \DateTime();
                $time->setTimestamp($shareTime);
                $share->method('getShareTime')->willReturn($time);
@@ -351,6 +352,7 @@ class ShareAPIControllerTest extends TestCase {
                        'mail_send' => 0,
                        'uid_file_owner' => 'ownerId',
                        'note' => 'personal note',
+                       'label' => '',
                        'displayname_file_owner' => 'ownerDisplay',
                        'mimetype' => 'myMimeType',
                        'hide_download' => 0,
@@ -396,6 +398,7 @@ class ShareAPIControllerTest extends TestCase {
                        'mail_send' => 0,
                        'uid_file_owner' => 'ownerId',
                        'note' => 'personal note',
+                       'label' => '',
                        'displayname_file_owner' => 'ownerDisplay',
                        'mimetype' => 'myFolderMimeType',
                        'hide_download' => 0,
@@ -419,7 +422,8 @@ class ShareAPIControllerTest extends TestCase {
                        0,
                        'personal note',
                        'token',
-                       'password'
+                       'password',
+                       'first link share'
                );
                $expected = [
                        'id' => 101,
@@ -445,6 +449,7 @@ class ShareAPIControllerTest extends TestCase {
                        'url' => 'url',
                        'uid_file_owner' => 'ownerId',
                        'note' => 'personal note',
+                       'label' => 'first link share',
                        'displayname_file_owner' => 'ownerDisplay',
                        'mimetype' => 'myFolderMimeType',
                        'hide_download' => 0,
@@ -2176,6 +2181,7 @@ class ShareAPIControllerTest extends TestCase {
                                'share_with' => 'recipient',
                                'share_with_displayname' => 'recipient',
                                'note' => 'personal note',
+                               'label' => null,
                                'mail_send' => 0,
                                'mimetype' => 'myMimeType',
                                'hide_download' => 0,
@@ -2196,6 +2202,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'ownerDN',
                                'note' => 'personal note',
+                               'label' => null,
                                'path' => 'file',
                                'item_type' => 'file',
                                'storage_id' => 'storageId',
@@ -2242,6 +2249,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => 'personal note',
+                               'label' => null,
                                'path' => 'file',
                                'item_type' => 'file',
                                'storage_id' => 'storageId',
@@ -2286,6 +2294,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => 'personal note',
+                               'label' => null,
                                'path' => 'file',
                                'item_type' => 'file',
                                'storage_id' => 'storageId',
@@ -2328,6 +2337,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => 'personal note',
+                               'label' => null,
                                'path' => 'file',
                                'item_type' => 'file',
                                'storage_id' => 'storageId',
@@ -2356,6 +2366,7 @@ class ShareAPIControllerTest extends TestCase {
                        ->setExpirationDate(new \DateTime('2001-01-02T00:00:00'))
                        ->setToken('myToken')
                        ->setNote('personal note')
+                       ->setLabel('new link share')
                        ->setId(42);
 
                $result[] = [
@@ -2372,6 +2383,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => 'personal note',
+                               'label' => 'new link share',
                                'path' => 'file',
                                'item_type' => 'file',
                                'storage_id' => 'storageId',
@@ -2415,6 +2427,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => 'personal note',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2459,6 +2472,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => '',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2502,6 +2516,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => '',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2545,6 +2560,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => '',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2603,6 +2619,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => '',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2648,6 +2665,7 @@ class ShareAPIControllerTest extends TestCase {
                                'uid_file_owner' => 'owner',
                                'displayname_file_owner' => 'owner',
                                'note' => '',
+                               'label' => null,
                                'path' => 'folder',
                                'item_type' => 'folder',
                                'storage_id' => 'storageId',
@@ -2803,6 +2821,7 @@ class ShareAPIControllerTest extends TestCase {
                                'mail_send' => 0,
                                'mimetype' => 'myMimeType',
                                'hide_download' => 0,
+                               'label' => '',
                        ], $share, false, []
                ];
 
@@ -2845,6 +2864,7 @@ class ShareAPIControllerTest extends TestCase {
                                'mail_send' => 0,
                                'mimetype' => 'myMimeType',
                                'hide_download' => 0,
+                               'label' => '',
                        ], $share, true, [
                                'share_with_displayname' => 'recipientRoomName'
                        ]