mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
test: adjust tests to getPath changes
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
5987584b90
commit
34d5a103b4
1 changed files with 18 additions and 9 deletions
|
|
@ -23,6 +23,7 @@ use OCP\Cache\CappedMemoryCache;
|
|||
use OCP\Constants;
|
||||
use OCP\Files\Config\IMountProvider;
|
||||
use OCP\Files\Config\IMountProviderCollection;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OCP\Files\GenericFileException;
|
||||
|
|
@ -258,28 +259,36 @@ class ViewTest extends \Test\TestCase {
|
|||
* @medium
|
||||
*/
|
||||
public function testGetPath(): void {
|
||||
$user = $this->createMock(IUser::class);
|
||||
$user->method('getUID')
|
||||
->willReturn('test');
|
||||
$storage1 = $this->getTestStorage();
|
||||
$storage2 = $this->getTestStorage();
|
||||
$storage3 = $this->getTestStorage();
|
||||
|
||||
Filesystem::mount($storage1, [], '/');
|
||||
Filesystem::mount($storage2, [], '/substorage');
|
||||
Filesystem::mount($storage3, [], '/folder/anotherstorage');
|
||||
Filesystem::mount($storage1, [], '/test/files');
|
||||
Filesystem::mount($storage2, [], '/test/files/substorage');
|
||||
Filesystem::mount($storage3, [], '/test/files/folder/anotherstorage');
|
||||
|
||||
$rootView = new View('');
|
||||
$userMountCache = Server::get(IUserMountCache::class);
|
||||
$userMountCache->registerMounts($user, [
|
||||
new MountPoint($storage1, '/test/files'),
|
||||
new MountPoint($storage2, '/test/files/substorage'),
|
||||
new MountPoint($storage3, '/test/files/folder/anotherstorage'),
|
||||
]);
|
||||
|
||||
$rootView = new View('/test/files');
|
||||
|
||||
|
||||
$cachedData = $rootView->getFileInfo('/foo.txt');
|
||||
/** @var int $id1 */
|
||||
$id1 = $cachedData['fileid'];
|
||||
$id1 = $cachedData->getId();
|
||||
$this->assertEquals('/foo.txt', $rootView->getPath($id1));
|
||||
|
||||
$cachedData = $rootView->getFileInfo('/substorage/foo.txt');
|
||||
/** @var int $id2 */
|
||||
$id2 = $cachedData['fileid'];
|
||||
$id2 = $cachedData->getId();
|
||||
$this->assertEquals('/substorage/foo.txt', $rootView->getPath($id2));
|
||||
|
||||
$folderView = new View('/substorage');
|
||||
$folderView = new View('/test/files/substorage');
|
||||
$this->assertEquals('/foo.txt', $folderView->getPath($id2));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue