Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix fs cache test user setup
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and PVince81 committed Feb 16, 2022
commit 417ead0a6bf61086a42252efa1d138908b517727
2 changes: 2 additions & 0 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ public static function initMountPoints($user = '') {
} elseif ($user instanceof IUser) {
$userObject = $user;
$user = $userObject->getUID();
} else {
$userObject = null;
}

if ($userObject === null || $user === false || $user === '') {
Expand Down
22 changes: 9 additions & 13 deletions tests/lib/Cache/FileCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace Test\Cache;

use OC\Files\Storage\Local;
use Test\Traits\UserTrait;

/**
* Class FileCacheTest
Expand All @@ -32,6 +33,8 @@
* @package Test\Cache
*/
class FileCacheTest extends TestCache {
use UserTrait;

/**
* @var string
* */
Expand All @@ -56,6 +59,12 @@ public function skip() {
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');

Expand All @@ -69,15 +78,6 @@ protected function setUp(): void {
$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');
Expand All @@ -101,10 +101,6 @@ protected function tearDown(): void {
$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, [], '/');
Expand Down