diff options
author | Robin Appelman <robin@icewind.nl> | 2022-02-01 13:53:22 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-02-09 16:01:28 +0100 |
commit | 2673775f6ebb7c3bee72fd08232746ad32595822 (patch) | |
tree | 9977809ac74352f9adc205b87afb7d44ebf8178f /tests | |
parent | 1ab58eff0f0e07aafd97a88647c2c72313506e53 (diff) | |
download | nextcloud-server-2673775f6ebb7c3bee72fd08232746ad32595822.tar.gz nextcloud-server-2673775f6ebb7c3bee72fd08232746ad32595822.zip |
fix fs cache test user setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Cache/FileCacheTest.php | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index 5791e28eb0c..a800fd005d9 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -23,6 +23,7 @@ namespace Test\Cache; use OC\Files\Storage\Local; +use Test\Traits\UserTrait; /** * Class FileCacheTest @@ -32,6 +33,8 @@ use OC\Files\Storage\Local; * @package Test\Cache */ class FileCacheTest extends TestCache { + use UserTrait; + /** * @var string * */ @@ -56,6 +59,12 @@ class FileCacheTest extends TestCache { protected function setUp(): void { parent::setUp(); + //login + $this->createUser('test', 'test'); + + $this->user = \OC_User::getUser(); + \OC_User::setUserId('test'); + //clear all proxies and hooks so we can do clean testing \OC_Hook::clear('OC_Filesystem'); @@ -69,15 +78,6 @@ class FileCacheTest extends TestCache { $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); $config->setSystemValue('cachedirectory', $datadir); - \OC_User::clearBackends(); - \OC_User::useBackend(new \Test\Util\User\Dummy()); - - //login - \OC::$server->getUserManager()->createUser('test', 'test'); - - $this->user = \OC_User::getUser(); - \OC_User::setUserId('test'); - //set up the users dir $this->rootView = new \OC\Files\View(''); $this->rootView->mkdir('/test'); @@ -101,10 +101,6 @@ class FileCacheTest extends TestCache { $this->instance = null; } - //tear down the users dir aswell - $user = \OC::$server->getUserManager()->get('test'); - $user->delete(); - // Restore the original mount point \OC\Files\Filesystem::clearMounts(); \OC\Files\Filesystem::mount($this->storage, [], '/'); |