Skip to content

Commit

Permalink
adjust unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle authored and danxuliu committed Nov 1, 2018
1 parent 5e90711 commit feb9f72
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function testGetGetShareNotExists() {

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);
Expand All @@ -263,6 +263,7 @@ public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner
$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);
Expand Down Expand Up @@ -351,6 +352,7 @@ public function dataGetShare() {
'mail_send' => 0,
'uid_file_owner' => 'ownerId',
'note' => 'personal note',
'label' => '',
'displayname_file_owner' => 'ownerDisplay',
'mimetype' => 'myMimeType',
'hide_download' => 0,
Expand Down Expand Up @@ -396,6 +398,7 @@ public function dataGetShare() {
'mail_send' => 0,
'uid_file_owner' => 'ownerId',
'note' => 'personal note',
'label' => '',
'displayname_file_owner' => 'ownerDisplay',
'mimetype' => 'myFolderMimeType',
'hide_download' => 0,
Expand All @@ -419,7 +422,8 @@ public function dataGetShare() {
0,
'personal note',
'token',
'password'
'password',
'first link share'
);
$expected = [
'id' => 101,
Expand All @@ -445,6 +449,7 @@ public function dataGetShare() {
'url' => 'url',
'uid_file_owner' => 'ownerId',
'note' => 'personal note',
'label' => 'first link share',
'displayname_file_owner' => 'ownerDisplay',
'mimetype' => 'myFolderMimeType',
'hide_download' => 0,
Expand Down Expand Up @@ -2176,6 +2181,7 @@ public function dataFormatShare() {
'share_with' => 'recipient',
'share_with_displayname' => 'recipient',
'note' => 'personal note',
'label' => null,
'mail_send' => 0,
'mimetype' => 'myMimeType',
'hide_download' => 0,
Expand All @@ -2196,6 +2202,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'ownerDN',
'note' => 'personal note',
'label' => null,
'path' => 'file',
'item_type' => 'file',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2242,6 +2249,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => 'personal note',
'label' => null,
'path' => 'file',
'item_type' => 'file',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2286,6 +2294,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => 'personal note',
'label' => null,
'path' => 'file',
'item_type' => 'file',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2328,6 +2337,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => 'personal note',
'label' => null,
'path' => 'file',
'item_type' => 'file',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2356,6 +2366,7 @@ public function dataFormatShare() {
->setExpirationDate(new \DateTime('2001-01-02T00:00:00'))
->setToken('myToken')
->setNote('personal note')
->setLabel('new link share')
->setId(42);

$result[] = [
Expand All @@ -2372,6 +2383,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => 'personal note',
'label' => 'new link share',
'path' => 'file',
'item_type' => 'file',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2415,6 +2427,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => 'personal note',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2459,6 +2472,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => '',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2502,6 +2516,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => '',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2545,6 +2560,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => '',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2603,6 +2619,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => '',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2648,6 +2665,7 @@ public function dataFormatShare() {
'uid_file_owner' => 'owner',
'displayname_file_owner' => 'owner',
'note' => '',
'label' => null,
'path' => 'folder',
'item_type' => 'folder',
'storage_id' => 'storageId',
Expand Down Expand Up @@ -2803,6 +2821,7 @@ public function dataFormatRoomShare() {
'mail_send' => 0,
'mimetype' => 'myMimeType',
'hide_download' => 0,
'label' => '',
], $share, false, []
];

Expand Down Expand Up @@ -2845,6 +2864,7 @@ public function dataFormatRoomShare() {
'mail_send' => 0,
'mimetype' => 'myMimeType',
'hide_download' => 0,
'label' => '',
], $share, true, [
'share_with_displayname' => 'recipientRoomName'
]
Expand Down

0 comments on commit feb9f72

Please sign in to comment.