Skip to content

Commit

Permalink
An attempt to fix testGetShares unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
  • Loading branch information
starypatyk committed Nov 1, 2022
1 parent 47523b9 commit 23d06ee
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,22 @@ function ($user, $shareType, $node) use ($shares) {
->method('outgoingServer2ServerGroupSharesAllowed')
->willReturn($extraShareTypes[ISHARE::TYPE_REMOTE_GROUP] ?? false);

$sharesWithoutTypes = [];
foreach ($shares as $file => &$fileShares) {
$sharesWithoutTypes[$file] = [];
foreach ($fileShares as $shareType => &$shareTypeShares) {
if ($shareType === ISHARE::TYPE_REMOTE or $shareType === ISHARE::TYPE_REMOTE_GROUP) {
if ($extraShareTypes[$shareType] ?? false) {
$sharesWithoutTypes[$file] = array_merge($sharesWithoutTypes[$file], $shareTypeShares);
}
} else {
$sharesWithoutTypes[$file] = array_merge($sharesWithoutTypes[$file], $shareTypeShares);
}
}
}
$this->shareManager
->method('getSharesInFolder')->willReturn($sharesWithoutTypes);

$this->groupManager
->method('isInGroup')
->willReturnCallback(
Expand Down

0 comments on commit 23d06ee

Please sign in to comment.