mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
test: adjust tests to new getById
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
02cf3d7c89
commit
918db6f5ba
1 changed files with 26 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue