Skip to content

Commit ba0718b

Browse files
committed
test: adjust tests to unsorted folder listing
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 06c625f commit ba0718b

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

build/integration/features/bootstrap/Sharing.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,10 @@ public function shareXIsReturnedWith(int $number, TableNode $body) {
556556

557557
$returnedShare = $this->getXmlResponse()->data[0];
558558
if ($returnedShare->element) {
559-
$returnedShare = $returnedShare->element[$number];
559+
$returnedShare = (array)$returnedShare;
560+
$returnedShare = $returnedShare['element'];
561+
usort($returnedShare, fn ($share1, $share2) => (int)$share1->id <=> (int)$share2->id);
562+
$returnedShare = $returnedShare[$number];
560563
}
561564

562565
$defaultExpectedFields = [

tests/lib/Files/ViewTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public function testCacheAPI(): void {
215215
$this->assertEquals('httpd/unix-directory', $cachedData['mimetype']);
216216

217217
$folderData = $rootView->getDirectoryContent('/');
218+
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
218219
/**
219220
* expected entries:
220221
* folder
@@ -234,6 +235,7 @@ public function testCacheAPI(): void {
234235
$this->assertEquals($storageSize, $folderData[3]['size']);
235236

236237
$folderData = $rootView->getDirectoryContent('/substorage');
238+
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
237239
/**
238240
* expected entries:
239241
* folder
@@ -2817,11 +2819,13 @@ public function testMountpointParentsCreated(): void {
28172819
$rootView = new View('');
28182820

28192821
$folderData = $rootView->getDirectoryContent('/');
2822+
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
28202823
$this->assertCount(4, $folderData);
2821-
$this->assertEquals('folder', $folderData[0]['name']);
2822-
$this->assertEquals('foo.png', $folderData[1]['name']);
2823-
$this->assertEquals('foo.txt', $folderData[2]['name']);
2824-
$this->assertEquals('A', $folderData[3]['name']);
2824+
2825+
$this->assertEquals('A', $folderData[0]['name']);
2826+
$this->assertEquals('folder', $folderData[1]['name']);
2827+
$this->assertEquals('foo.png', $folderData[2]['name']);
2828+
$this->assertEquals('foo.txt', $folderData[3]['name']);
28252829

28262830
$folderData = $rootView->getDirectoryContent('/A');
28272831
$this->assertCount(1, $folderData);
@@ -2832,6 +2836,7 @@ public function testMountpointParentsCreated(): void {
28322836
$this->assertEquals('C', $folderData[0]['name']);
28332837

28342838
$folderData = $rootView->getDirectoryContent('/A/B/C');
2839+
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
28352840
$this->assertCount(3, $folderData);
28362841
$this->assertEquals('folder', $folderData[0]['name']);
28372842
$this->assertEquals('foo.png', $folderData[1]['name']);

0 commit comments

Comments
 (0)