summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-03-01 16:00:45 +0100
committerGitHub <noreply@github.com>2022-03-01 16:00:45 +0100
commit64f376e4b9804113862bc280574aefbe7de4e05a (patch)
tree28d4fe9a02fd2008ad4b73d2a5d11a351018f400 /tests
parentabc1b8f997a8e304378938b8a760b7298a1fa25d (diff)
parent7f5a3695b730b4ba9f96310e618c63a1da54c9b1 (diff)
downloadnextcloud-server-64f376e4b9804113862bc280574aefbe7de4e05a.tar.gz
nextcloud-server-64f376e4b9804113862bc280574aefbe7de4e05a.zip
Merge pull request #31098 from nextcloud/backport/30942/stable23
[stable23] only setup part of the filesystem for appdata requests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Cache/FileCacheTest.php22
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, [], '/');