diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 6b669720cb267..9b59db661f838 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -556,7 +556,13 @@ public function shareXIsReturnedWith(int $number, TableNode $body) { $returnedShare = $this->getXmlResponse()->data[0]; if ($returnedShare->element) { - $returnedShare = $returnedShare->element[$number]; + $returnedShare = (array)$returnedShare; + $returnedShare = $returnedShare['element']; + if (is_array($returnedShare)) { + usort($returnedShare, fn ($share1, $share2) => (int)$share1->id <=> (int)$share2->id); + } + + $returnedShare = $returnedShare[$number]; } $defaultExpectedFields = [ diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index d14aac58850bd..7a811631a9a77 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -221,8 +221,7 @@ public function getFolderContentsById($fileId) { $query = $this->getQueryBuilder(); $query->selectFileCache() ->whereParent($fileId) - ->whereStorageId($this->getNumericStorageId()) - ->orderBy('name', 'ASC'); + ->whereStorageId($this->getNumericStorageId()); $metadataQuery = $query->selectMetadata(); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 72df3810f1909..806f678aa5114 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -209,6 +209,7 @@ public function testCacheAPI(): void { $this->assertEquals('httpd/unix-directory', $cachedData['mimetype']); $folderData = $rootView->getDirectoryContent('/'); + usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName()); /** * expected entries: * folder @@ -228,6 +229,7 @@ public function testCacheAPI(): void { $this->assertEquals($storageSize, $folderData[3]['size']); $folderData = $rootView->getDirectoryContent('/substorage'); + usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName()); /** * expected entries: * folder @@ -2812,11 +2814,13 @@ public function testMountpointParentsCreated(): void { $rootView = new View(''); $folderData = $rootView->getDirectoryContent('/'); + usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName()); $this->assertCount(4, $folderData); - $this->assertEquals('folder', $folderData[0]['name']); - $this->assertEquals('foo.png', $folderData[1]['name']); - $this->assertEquals('foo.txt', $folderData[2]['name']); - $this->assertEquals('A', $folderData[3]['name']); + + $this->assertEquals('A', $folderData[0]['name']); + $this->assertEquals('folder', $folderData[1]['name']); + $this->assertEquals('foo.png', $folderData[2]['name']); + $this->assertEquals('foo.txt', $folderData[3]['name']); $folderData = $rootView->getDirectoryContent('/A'); $this->assertCount(1, $folderData); @@ -2827,6 +2831,7 @@ public function testMountpointParentsCreated(): void { $this->assertEquals('C', $folderData[0]['name']); $folderData = $rootView->getDirectoryContent('/A/B/C'); + usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName()); $this->assertCount(3, $folderData); $this->assertEquals('folder', $folderData[0]['name']); $this->assertEquals('foo.png', $folderData[1]['name']);