diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 536e2b8bfa22c..14e736b90f271 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -555,7 +555,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 8b2cdfbabeb61..0f15254249cc4 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -208,8 +208,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 e7ad9fcc3046f..376b2cb0cfd5b 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -211,6 +211,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 @@ -230,6 +231,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 @@ -2875,11 +2877,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); @@ -2890,6 +2894,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']);