diff options
author | Joas Schilling <coding@schilljs.com> | 2021-02-02 15:45:34 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-02-15 10:36:08 +0100 |
commit | 645f83121eb9bdc936c404ac8dbad346c2b934e3 (patch) | |
tree | 4556c7b6e70064271ec8f49176a7fd5545d86cea /tests/lib/Files | |
parent | b418a680e7431dd39acfdc1c52c693ae777a8c83 (diff) | |
download | nextcloud-server-645f83121eb9bdc936c404ac8dbad346c2b934e3.tar.gz nextcloud-server-645f83121eb9bdc936c404ac8dbad346c2b934e3.zip |
Cache the user backend info for 300s
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/Config/UserMountCacheTest.php | 3 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 22 | ||||
-rw-r--r-- | tests/lib/Files/Stream/EncryptionTest.php | 8 |
3 files changed, 28 insertions, 5 deletions
diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index 2bea4f8389a..d170049aab5 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -15,6 +15,7 @@ use OC\Log; use OC\User\Manager; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\ICachedMountInfo; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; use OCP\IUserManager; @@ -46,7 +47,7 @@ class UserMountCacheTest extends TestCase { protected function setUp(): void { $this->fileIds = []; $this->connection = \OC::$server->getDatabaseConnection(); - $this->userManager = new Manager($this->createMock(IConfig::class), $this->createMock(EventDispatcherInterface::class), $this->createMock(IEventDispatcher::class)); + $this->userManager = new Manager($this->createMock(IConfig::class), $this->createMock(EventDispatcherInterface::class), $this->createMock(ICacheFactory::class), $this->createMock(IEventDispatcher::class)); $userBackend = new Dummy(); $userBackend->createUser('u1', ''); $userBackend->createUser('u2', ''); diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index eccec7c28d5..8bdb48fd854 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -17,6 +17,7 @@ use OCP\Encryption\Keys\IStorage; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Cache\ICache; use OCP\Files\Mount\IMountPoint; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -131,7 +132,12 @@ class EncryptionTest extends Storage { $this->util = $this->getMockBuilder('\OC\Encryption\Util') ->setMethods(['getUidAndFilename', 'isFile', 'isExcluded']) - ->setConstructorArgs([new View(), new Manager($this->config, $this->createMock(EventDispatcherInterface::class), $this->createMock(IEventDispatcher::class)), $this->groupManager, $this->config, $this->arrayCache]) + ->setConstructorArgs([new View(), new Manager( + $this->config, + $this->createMock(EventDispatcherInterface::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ), $this->groupManager, $this->config, $this->arrayCache]) ->getMock(); $this->util->expects($this->any()) ->method('getUidAndFilename') @@ -567,7 +573,12 @@ class EncryptionTest extends Storage { ->setConstructorArgs( [ new View(), - new Manager($this->config, $this->createMock(EventDispatcherInterface::class), $this->createMock(IEventDispatcher::class)), + new Manager( + $this->config, + $this->createMock(EventDispatcherInterface::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ), $this->groupManager, $this->config, $this->arrayCache @@ -635,7 +646,12 @@ class EncryptionTest extends Storage { ->willReturn($exists); $util = $this->getMockBuilder('\OC\Encryption\Util') - ->setConstructorArgs([new View(), new Manager($this->config, $this->createMock(EventDispatcherInterface::class), $this->createMock(IEventDispatcher::class)), $this->groupManager, $this->config, $this->arrayCache]) + ->setConstructorArgs([new View(), new Manager( + $this->config, + $this->createMock(EventDispatcherInterface::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ), $this->groupManager, $this->config, $this->arrayCache]) ->getMock(); $cache = $this->getMockBuilder('\OC\Files\Cache\Cache') diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index 08264f07fcf..5516c0bf658 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -7,6 +7,7 @@ use OC\Files\View; use OC\Memcache\ArrayCache; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Cache\ICache; +use OCP\ICacheFactory; use OCP\IConfig; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -49,7 +50,12 @@ class EncryptionTest extends \Test\TestCase { $file->expects($this->any())->method('getAccessList')->willReturn([]); $util = $this->getMockBuilder('\OC\Encryption\Util') ->setMethods(['getUidAndFilename']) - ->setConstructorArgs([new View(), new \OC\User\Manager($config, $this->createMock(EventDispatcherInterface::class), $this->createMock(IEventDispatcher::class)), $groupManager, $config, $arrayCache]) + ->setConstructorArgs([new View(), new \OC\User\Manager( + $config, + $this->createMock(EventDispatcherInterface::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ), $groupManager, $config, $arrayCache]) ->getMock(); $util->expects($this->any()) ->method('getUidAndFilename') |