From 4b112f709895d80f7bb2892d4f4159653a75fd24 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/lib/Sharing/AbstractSharingManagerTests.php b/tests/lib/Sharing/AbstractSharingManagerTests.php index 8f4522dc86ff2..ee708d8637cc5 100644 --- a/tests/lib/Sharing/AbstractSharingManagerTests.php +++ b/tests/lib/Sharing/AbstractSharingManagerTests.php @@ -3019,6 +3019,9 @@ public function testGetShareWithPublicSecret(bool $isSecretPublic): void { unset($share['last_updated']); $this->assertIsList($share['recipients']); $this->assertCount(2, $share['recipients']); + // The order in which recipients are returned by the database is not guaranteed, + // so sort them to make assertions on specific indexes reliable. + usort($share['recipients'], fn (array $a, array $b): int => $a['value'] <=> $b['value']); $this->assertEquals([ 'class' => TestShareRecipientType1::class, 'value' => 'recipient1',