Skip to content

Commit

Permalink
fix(tests): Fix Folder tests
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc authored and backportbot[bot] committed Sep 18, 2024
1 parent d0bf592 commit dd5e68c
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/lib/Files/Node/FolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ public function testSearchInRoot() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$cache->insert('files', ['size' => 200, 'mtime' => 55, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]);
$cache->insert('files/foo', ['size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']);
Expand Down Expand Up @@ -392,6 +394,8 @@ public function testSearchInStorageRoot() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$cache->insert('foo', ['size' => 200, 'mtime' => 55, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]);
$cache->insert('foo/qwerty', ['size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']);
Expand Down Expand Up @@ -443,9 +447,13 @@ public function testSearchSubStorages() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$subStorage->method('getCache')
->willReturn($subCache);
$subStorage->method('getOwner')
->willReturn('owner');

$cache->insert('foo', ['size' => 200, 'mtime' => 55, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]);
$cache->insert('foo/qwerty', ['size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain']);
Expand Down Expand Up @@ -497,6 +505,8 @@ public function testGetById() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
Expand Down Expand Up @@ -544,6 +554,8 @@ public function testGetByIdMountRoot() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
Expand Down Expand Up @@ -587,6 +599,8 @@ public function testGetByIdOutsideFolder() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
Expand Down Expand Up @@ -630,6 +644,8 @@ public function testGetByIdMultipleStorages() {

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$this->userMountCache->method('getMountsForFileId')
->with(1)
Expand All @@ -645,9 +661,6 @@ public function testGetByIdMultipleStorages() {
),
]);

$storage->method('getCache')
->willReturn($cache);

$cache->method('get')
->with(1)
->willReturn($fileInfo);
Expand Down Expand Up @@ -949,9 +962,13 @@ public function testSearchSubStoragesLimitOffset(int $offset, int $limit, array

$storage->method('getCache')
->willReturn($cache);
$storage->method('getOwner')
->willReturn('owner');

$subStorage1->method('getCache')
->willReturn($subCache1);
$subStorage1->method('getOwner')
->willReturn('owner');

$subMount2->method('getStorage')
->willReturn($subStorage2);
Expand All @@ -961,6 +978,8 @@ public function testSearchSubStoragesLimitOffset(int $offset, int $limit, array

$subStorage2->method('getCache')
->willReturn($subCache2);
$subStorage2->method('getOwner')
->willReturn('owner');

$cache->insert('foo/foo1', ['size' => 200, 'mtime' => 10, 'mimetype' => 'text/plain']);
$cache->insert('foo/foo2', ['size' => 200, 'mtime' => 20, 'mimetype' => 'text/plain']);
Expand Down

0 comments on commit dd5e68c

Please sign in to comment.