add tests for cached mount provider migration

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2022-08-15 12:45:41 +02:00
parent 10767d7779
commit 887952b4f4
1 changed files with 25 additions and 0 deletions

View File

@ -507,4 +507,29 @@ class UserMountCacheTest extends TestCase {
$result = $this->cache->getUsedSpaceForUsers([$user1, $user2]);
$this->assertEquals(['u1' => 100], $result);
}
public function testMigrateMountProvider() {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
$rootId = $this->createCacheEntry('', 2);
$mount1 = new MountPoint($storage1, '/foo/');
$this->cache->registerMounts($user1, [$mount1]);
$this->clearCache();
$cachedMounts = $this->cache->getMountsForUser($user1);
$this->assertCount(1, $cachedMounts);
$this->assertEquals('', $cachedMounts[0]->getMountProvider());
$mount1 = new MountPoint($storage1, '/foo/', null, null, null, null, 'dummy');
$this->cache->registerMounts($user1, [$mount1], ['dummy']);
$this->clearCache();
$cachedMounts = $this->cache->getMountsForUser($user1);
$this->assertCount(1, $cachedMounts);
$this->assertEquals('dummy', $cachedMounts[0]->getMountProvider());
}
}