From 918db6f5ba4a589126ac41e3043aac1682aba427 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 29 Jan 2026 17:32:37 +0100 Subject: [PATCH] test: adjust tests to new getById Signed-off-by: Robin Appelman --- tests/lib/Files/Node/FolderTest.php | 34 ++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index ad60cb53555..19374fee6c1 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -29,6 +29,7 @@ use OC\Files\Storage\Wrapper\Jail; use OC\Files\View; use OCP\Constants; use OCP\Files\Cache\ICacheEntry; +use OCP\Files\Config\ICachedMountInfo; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; @@ -538,8 +539,8 @@ class FolderTest extends NodeTestCase { ->with('/bar/foo') ->willReturn([]); - $manager->method('getMountsByMountProvider') - ->willReturn([$mount]); + $manager->method('getMountFromMountInfo') + ->willReturn($mount); $node = new Folder($root, $view, '/bar/foo'); $result = $node->getById(1); @@ -583,8 +584,8 @@ class FolderTest extends NodeTestCase { ->with(1) ->willReturn($fileInfo); - $manager->method('getMountsByMountProvider') - ->willReturn([$mount]); + $manager->method('getMountFromMountInfo') + ->willReturn($mount); $node = new Folder($root, $view, '/bar'); $result = $node->getById(1); @@ -628,8 +629,8 @@ class FolderTest extends NodeTestCase { ->with(1) ->willReturn($fileInfo); - $manager->method('getMountsByMountProvider') - ->willReturn([$mount]); + $manager->method('getMountFromMountInfo') + ->willReturn($mount); $node = new Folder($root, $view, '/bar/foo'); $result = $node->getById(1); @@ -668,14 +669,31 @@ class FolderTest extends NodeTestCase { 1, '' ), + new CachedMountInfo( + $this->user, + 1, + 0, + '/bar/foo/asd/', + 'test', + 1, + '' + ), ]); $cache->method('get') ->with(1) ->willReturn($fileInfo); - $manager->method('getMountsByMountProvider') - ->willReturn([$mount1, $mount2]); + $manager->method('getMountFromMountInfo') + ->willReturnCallback(function (ICachedMountInfo $mountInfo) use ($mount1, $mount2) { + if ($mountInfo->getMountPoint() === $mount1->getMountPoint()) { + return $mount1; + } + if ($mountInfo->getMountPoint() === $mount2->getMountPoint()) { + return $mount2; + } + return null; + }); $node = new Folder($root, $view, '/bar/foo'); $result = $node->getById(1);