test: adjust tests to new getById

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-01-29 17:32:37 +01:00
parent 02cf3d7c89
commit 918db6f5ba
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -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);