Skip to content

Commit 80046aa

Browse files
committed
test(sharing): sort recipients before asserting in testGetShareWithPublicSecret
The error in question ```diff ApiV1ControllerTest::testGetShareWithPublicSecret with data set #0 (true) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array ( - 'class' => 'Test\Sharing\TestShareRecipientType1' - 'value' => 'recipient1' + 'class' => 'Test\Sharing\TestShareRecipientTypePublicSecret' + 'value' => 'recipient2' 'instance' => null - 'display_name' => 'Recipient 1' + 'display_name' => 'Recipient 2' 'icon' => [...] 'secret' => Array ( 'updatable' => false + 'value' => '47BN3fes63WP0usnjUyF3pUYJh36RHMl' + 'url' => 'http://localhost/index.php/s/...36RHMl' ) 'initiator' => [...] ) ``` Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 0556391 commit 80046aa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/lib/Sharing/AbstractSharingManagerTests.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,6 +3019,8 @@ public function testGetShareWithPublicSecret(bool $isSecretPublic): void {
30193019
unset($share['last_updated']);
30203020
$this->assertIsList($share['recipients']);
30213021
$this->assertCount(2, $share['recipients']);
3022+
// Sort because database order is not guaranteed
3023+
usort($share['recipients'], fn (array $a, array $b): int => $a['value'] <=> $b['value']);
30223024
$this->assertEquals([
30233025
'class' => TestShareRecipientType1::class,
30243026
'value' => 'recipient1',
@@ -3159,6 +3161,9 @@ public function testGetShareUniqueDisplayNames(): void {
31593161
$this->dbConnection->commit();
31603162

31613163
$share = $this->getShare($accessContext, $id);
3164+
3165+
// Sort because database order is not guaranteed
3166+
usort($share['sources'], fn (array $a, array $b): int => $a['value'] <=> $b['value']);
31623167
usort($share['recipients'], fn (array $a, array $b): int => $a['value'] <=> $b['value']);
31633168
$this->assertEquals([
31643169
[

0 commit comments

Comments
 (0)