mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix fs cache test user setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
1ab58eff0f
commit
2673775f6e
2 changed files with 11 additions and 13 deletions
|
|
@ -368,6 +368,8 @@ class Filesystem {
|
|||
} elseif ($user instanceof IUser) {
|
||||
$userObject = $user;
|
||||
$user = $userObject->getUID();
|
||||
} else {
|
||||
$userObject = null;
|
||||
}
|
||||
|
||||
if ($userObject === null || $user === false || $user === '') {
|
||||
|
|
|
|||
|
|
@ -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, [], '/');
|
||||
|
|
|
|||
Loading…
Reference in a new issue