From 80046aae1dda4f07781ceea76d098c5a549eadc0 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 4 Aug 2026 18:41:15 +0200 Subject: [PATCH] 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 --- tests/lib/Sharing/AbstractSharingManagerTests.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib/Sharing/AbstractSharingManagerTests.php b/tests/lib/Sharing/AbstractSharingManagerTests.php index 62260bbf2ae2f..0391dbd93ea52 100644 --- a/tests/lib/Sharing/AbstractSharingManagerTests.php +++ b/tests/lib/Sharing/AbstractSharingManagerTests.php @@ -3019,6 +3019,8 @@ public function testGetShareWithPublicSecret(bool $isSecretPublic): void { unset($share['last_updated']); $this->assertIsList($share['recipients']); $this->assertCount(2, $share['recipients']); + // Sort because database order is not guaranteed + usort($share['recipients'], fn (array $a, array $b): int => $a['value'] <=> $b['value']); $this->assertEquals([ 'class' => TestShareRecipientType1::class, 'value' => 'recipient1', @@ -3159,6 +3161,9 @@ public function testGetShareUniqueDisplayNames(): void { $this->dbConnection->commit(); $share = $this->getShare($accessContext, $id); + + // Sort because database order is not guaranteed + usort($share['sources'], fn (array $a, array $b): int => $a['value'] <=> $b['value']); usort($share['recipients'], fn (array $a, array $b): int => $a['value'] <=> $b['value']); $this->assertEquals([ [