diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index 742948b7ac32755a990de930b9ce4aedbe163daf..3b51e4a9e6d5c4352f79c859a080f20902994e04 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -91,23 +91,21 @@ class TransferOwnership extends Command {
 	}
 
 	protected function execute(InputInterface $input, OutputInterface $output) {
-		$this->sourceUser = $input->getArgument('source-user');
-		$this->destinationUser = $input->getArgument('destination-user');
-		$source = $this->userManager->get($this->sourceUser);
-		$destination = $this->userManager->get($this->destinationUser);
+		$sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
+		$destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
 
-		if (!$source instanceof IUser) {
+		if (!$sourceUserObject instanceof IUser) {
 			$output->writeln("<error>Unknown source user $this->sourceUser</error>");
 			return;
 		}
 
-		if (!$destination instanceof IUser) {
+		if (!$destinationUserObject instanceof IUser) {
 			$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
 			return;
 		}
 
-		$this->sourceUser = $source->getUID();
-		$this->destinationUser = $destination->getUID();
+		$this->sourceUser = $sourceUserObject->getUID();
+		$this->destinationUser = $destinationUserObject->getUID();
 
 		// target user has to be ready
 		if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) {
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index 113bb5a85c63f16993129e64549054b3610f1ad3..d2662af527a69b256f4cf339aca364a19a7e0687 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -394,9 +394,6 @@ class Filesystem {
 		if ($user === null || $user === false || $user === '') {
 			throw new \OC\User\NoUserException('Attempted to initialize mount points for null user and no user in session');
 		}
-		if (isset(self::$usersSetup[$user])) {
-			return;
-		}
 
 		$userManager = \OC::$server->getUserManager();
 		$userObject = $userManager->get($user);
@@ -406,6 +403,17 @@ class Filesystem {
 			throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
 		}
 
+		// workaround in case of different casings
+		if ($user !== $userObject->getUID()) {
+			$stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50));
+			\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $userObject->getUID() . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN);
+		}
+		$user = $userObject->getUID();
+
+		if (isset(self::$usersSetup[$user])) {
+			return;
+		}
+
 		self::$usersSetup[$user] = true;
 
 		/** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 0cda2c8b822891c77fdef7468003e2ef4a8a847d..515a795d6e023f73859cdef5a49d645e7cfdb667 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -36,6 +36,8 @@ use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OC\Hooks\PublicEmitter;
 use OCP\Files\IRootFolder;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 /**
  * Class Root
@@ -57,42 +59,43 @@ use OCP\Files\IRootFolder;
  * @package OC\Files\Node
  */
 class Root extends Folder implements IRootFolder {
-
-	/**
-	 * @var \OC\Files\Mount\Manager $mountManager
-	 */
+	/** @var Manager */
 	private $mountManager;
-
-	/**
-	 * @var \OC\Hooks\PublicEmitter
-	 */
+	/** @var PublicEmitter */
 	private $emitter;
-
-	/**
-	 * @var \OC\User\User $user
-	 */
+	/** @var null|\OC\User\User */
 	private $user;
-
+	/** @var CappedMemoryCache */
 	private $userFolderCache;
-
-	/**
-	 * @var IUserMountCache
-	 */
+	/** @var IUserMountCache */
 	private $userMountCache;
+	/** @var ILogger */
+	private $logger;
+	/** @var IUserManager */
+	private $userManager;
 
 	/**
 	 * @param \OC\Files\Mount\Manager $manager
 	 * @param \OC\Files\View $view
 	 * @param \OC\User\User|null $user
 	 * @param IUserMountCache $userMountCache
-	 */
-	public function __construct($manager, $view, $user, IUserMountCache $userMountCache) {
+	 * @param ILogger $logger
+	 * @param IUserManager $userManager
+	 */
+	public function __construct($manager,
+								$view,
+								$user,
+								IUserMountCache $userMountCache,
+								ILogger $logger,
+								IUserManager $userManager) {
 		parent::__construct($this, $view, '');
 		$this->mountManager = $manager;
 		$this->user = $user;
 		$this->emitter = new PublicEmitter();
 		$this->userFolderCache = new CappedMemoryCache();
 		$this->userMountCache = $userMountCache;
+		$this->logger = $logger;
+		$this->userManager = $userManager;
 	}
 
 	/**
@@ -345,8 +348,26 @@ class Root extends Folder implements IRootFolder {
 	 *
 	 * @param String $userId user ID
 	 * @return \OCP\Files\Folder
+	 * @throws \OC\User\NoUserException
 	 */
 	public function getUserFolder($userId) {
+		$userObject = $this->userManager->get($userId);
+
+		if (is_null($userObject)) {
+			$this->logger->error(
+				sprintf(
+					'Backends provided no user object for %s',
+					$userId
+				),
+				[
+					'app' => 'files',
+				]
+			);
+			throw new \OC\User\NoUserException('Backends provided no user object');
+		}
+
+		$userId = $userObject->getUID();
+
 		if (!$this->userFolderCache->hasKey($userId)) {
 			\OC\Files\Filesystem::initMountPoints($userId);
 
diff --git a/lib/private/Server.php b/lib/private/Server.php
index dca50c15733de04381cb0c52d95baa11da00a0ad..9f993ade7fec670c83f5ea6c6a707cd7913cc18b 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -182,7 +182,14 @@ class Server extends ServerContainer implements IServerContainer {
 		$this->registerService('RootFolder', function (Server $c) {
 			$manager = \OC\Files\Filesystem::getMountManager(null);
 			$view = new View();
-			$root = new Root($manager, $view, null, $c->getUserMountCache());
+			$root = new Root(
+				$manager,
+				$view,
+				null,
+				$c->getUserMountCache(),
+				$this->getLogger(),
+				$this->getUserManager()
+			);
 			$connector = new HookConnector($root, $view);
 			$connector->viewToNode();
 			return $root;
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 33801cd634704e8561260b0a51cbc0b11ca2b1df..f6da19f3bb896eb944d54771049f6952521aa481 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -45,6 +45,8 @@ namespace OC\Share;
 use OC\Files\Filesystem;
 use OCA\FederatedFileSharing\DiscoveryManager;
 use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\ILogger;
+use OCP\IUserManager;
 use OCP\IUserSession;
 use OCP\IDBConnection;
 use OCP\IConfig;
@@ -128,14 +130,39 @@ class Share extends Constants {
 	 * Find which users can access a shared item
 	 * @param string $path to the file
 	 * @param string $ownerUser owner of the file
+	 * @param IUserManager $userManager
+	 * @param ILogger $logger
 	 * @param boolean $includeOwner include owner to the list of users with access to the file
 	 * @param boolean $returnUserPaths Return an array with the user => path map
 	 * @param boolean $recursive take all parent folders into account (default true)
 	 * @return array
 	 * @note $path needs to be relative to user data dir, e.g. 'file.txt'
 	 *       not '/admin/data/file.txt'
+	 * @throws \OC\User\NoUserException
 	 */
-	public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
+	public static function getUsersSharingFile($path,
+											   $ownerUser,
+											   IUserManager $userManager,
+											   ILogger $logger,
+											   $includeOwner = false,
+											   $returnUserPaths = false,
+											   $recursive = true) {
+		$userObject = $userManager->get($ownerUser);
+
+		if (is_null($userObject)) {
+			$logger->error(
+				sprintf(
+					'Backends provided no user object for %s',
+					$ownerUser
+				),
+				[
+					'app' => 'files',
+				]
+			);
+			throw new \OC\User\NoUserException('Backends provided no user object');
+		}
+
+		$ownerUser = $userObject->getUID();
 
 		Filesystem::initMountPoints($ownerUser);
 		$shares = $sharePaths = $fileTargets = array();
diff --git a/lib/public/Share.php b/lib/public/Share.php
index bc7aa828f627214b8ff048a4aedbf103f5dd60aa..ec3a7c8db1b44370f492358a906b02a31f2c8e79 100644
--- a/lib/public/Share.php
+++ b/lib/public/Share.php
@@ -89,7 +89,15 @@ class Share extends \OC\Share\Constants {
 	 * @since 5.0.0 - $recursive was added in 9.0.0
 	 */
 	public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
-		return \OC\Share\Share::getUsersSharingFile($path, $ownerUser, $includeOwner, $returnUserPaths, $recursive);
+		return \OC\Share\Share::getUsersSharingFile(
+			$path,
+			$ownerUser,
+			\OC::$server->getUserManager(),
+			\OC::$server->getLogger(),
+			$includeOwner,
+			$returnUserPaths,
+			$recursive
+		);
 	}
 
 	/**
diff --git a/tests/lib/AvatarManagerTest.php b/tests/lib/AvatarManagerTest.php
index 8ccc51d12e0f60d03018edfe81b0a9fab23c65df..83a5cfd9b30ce06eb4348973370c55776ab24de2 100644
--- a/tests/lib/AvatarManagerTest.php
+++ b/tests/lib/AvatarManagerTest.php
@@ -26,6 +26,7 @@ namespace Test;
 
 use OC\Avatar;
 use OC\AvatarManager;
+use OC\Files\AppData\AppData;
 use OCP\Files\IAppData;
 use OCP\Files\SimpleFS\ISimpleFolder;
 use OCP\IConfig;
@@ -48,7 +49,7 @@ class AvatarManagerTest extends \Test\TestCase {
 	private $logger;
 	/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
 	private $config;
-	/** @var AvatarManager */
+	/** @var AvatarManager | \PHPUnit_Framework_MockObject_MockObject */
 	private $avatarManager;
 
 	public function setUp() {
@@ -101,8 +102,29 @@ class AvatarManagerTest extends \Test\TestCase {
 			->with('valid-user')
 			->willReturn($folder);
 
-		$expected = new Avatar($folder, $this->l10n, $user, $this->logger, $this->config);;
+		$expected = new Avatar($folder, $this->l10n, $user, $this->logger, $this->config);
 		$this->assertEquals($expected, $this->avatarManager->getAvatar('valid-user'));
 	}
 
+	public function testGetAvatarValidUserDifferentCasing() {
+		$user = $this->createMock(IUser::class);
+		$this->userManager->expects($this->once())
+			->method('get')
+			->with('vaLid-USER')
+			->willReturn($user);
+
+		$user->expects($this->once())
+			->method('getUID')
+			->willReturn('valid-user');
+
+		$folder = $this->createMock(ISimpleFolder::class);
+		$this->appData
+			->expects($this->once())
+			->method('getFolder')
+			->with('valid-user')
+			->willReturn($folder);
+
+		$expected = new Avatar($folder, $this->l10n, $user, $this->logger, $this->config);
+		$this->assertEquals($expected, $this->avatarManager->getAvatar('vaLid-USER'));
+	}
 }
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 210ce4edc69cac077c45e3edbafa2cc824129b59..dd4785ecf090f7a57254ad988a22a391b83e282a 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -368,6 +368,39 @@ class FilesystemTest extends \Test\TestCase {
 		$this->assertEquals(2, $thrown);
 	}
 
+	public function testUserNameCasing() {
+		$this->logout();
+		$userId = $this->getUniqueID('user_');
+
+		\OC_User::clearBackends();
+		// needed for loginName2UserName mapping
+		$userBackend = $this->createMock(\OC\User\Database::class);
+		\OC::$server->getUserManager()->registerBackend($userBackend);
+
+		$userBackend->expects($this->once())
+			->method('userExists')
+			->with(strtoupper($userId))
+			->will($this->returnValue(true));
+		$userBackend->expects($this->once())
+			->method('loginName2UserName')
+			->with(strtoupper($userId))
+			->will($this->returnValue($userId));
+
+		$view = new \OC\Files\View();
+		$this->assertFalse($view->file_exists('/' . $userId));
+
+		\OC\Files\Filesystem::initMountPoints(strtoupper($userId));
+
+		list($storage1, $path1) = $view->resolvePath('/' . $userId);
+		list($storage2, $path2) = $view->resolvePath('/' . strtoupper($userId));
+
+		$this->assertTrue($storage1->instanceOfStorage('\OCP\Files\IHomeStorage'));
+		$this->assertEquals('', $path1);
+
+		// not mounted, still on the local root storage
+		$this->assertEquals(strtoupper($userId), $path2);
+	}
+
 	/**
 	 * Tests that the home storage is used for the user's mount point
 	 */
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index b7a2fa2a1a311196b4d71479fab715a82138e46b..823e3b502494e11cc76efb205c4bc366cb526b63 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -10,19 +10,22 @@ namespace Test\Files\Node;
 
 use OC\Files\FileInfo;
 use OCP\Files\NotFoundException;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 class FileTest extends \Test\TestCase {
 	/** @var \OC\User\User */
 	private $user;
-
 	/** @var \OC\Files\Mount\Manager */
 	private $manager;
-
 	/** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */
 	private $view;
-
 	/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
 	private $userMountCache;
+	/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+	private $logger;
+	/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+	private $userManager;
 
 	protected function setUp() {
 		parent::setUp();
@@ -30,7 +33,6 @@ class FileTest extends \Test\TestCase {
 			->disableOriginalConstructor()
 			->getMock();
 		$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config);
-
 		$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
 			->disableOriginalConstructor()
 			->getMock();
@@ -40,6 +42,8 @@ class FileTest extends \Test\TestCase {
 		$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
 			->disableOriginalConstructor()
 			->getMock();
+		$this->logger = $this->createMock(ILogger::class);
+		$this->userManager = $this->createMock(IUserManager::class);
 	}
 
 	protected function getMockStorage() {
@@ -58,7 +62,7 @@ class FileTest extends \Test\TestCase {
 	public function testDelete() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$root->expects($this->exactly(2))
@@ -108,7 +112,14 @@ class FileTest extends \Test\TestCase {
 			$hooksRun++;
 		};
 
-		$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$root->listen('\OC\Files', 'preDelete', $preListener);
 		$root->listen('\OC\Files', 'postDelete', $postListener);
 
@@ -138,7 +149,7 @@ class FileTest extends \Test\TestCase {
 	public function testDeleteNotPermitted() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$root->expects($this->any())
@@ -157,7 +168,7 @@ class FileTest extends \Test\TestCase {
 	public function testGetContent() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$hook = function ($file) {
@@ -187,7 +198,7 @@ class FileTest extends \Test\TestCase {
 	public function testGetContentNotPermitted() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$root->expects($this->any())
@@ -206,7 +217,7 @@ class FileTest extends \Test\TestCase {
 	public function testPutContent() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$root->expects($this->any())
@@ -233,7 +244,7 @@ class FileTest extends \Test\TestCase {
 	public function testPutContentNotPermitted() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->once())
@@ -248,7 +259,7 @@ class FileTest extends \Test\TestCase {
 	public function testGetMimeType() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->once())
@@ -265,7 +276,14 @@ class FileTest extends \Test\TestCase {
 		fwrite($stream, 'bar');
 		rewind($stream);
 
-		$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 
 		$hook = function ($file) {
 			throw new \Exception('Hooks are not supposed to be called');
@@ -293,8 +311,14 @@ class FileTest extends \Test\TestCase {
 	public function testFOpenWrite() {
 		$stream = fopen('php://memory', 'w+');
 
-		$root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user, $this->userMountCache);
-
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			new $this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$hooksCalled = 0;
 		$hook = function ($file) use (&$hooksCalled) {
 			$hooksCalled++;
@@ -326,8 +350,14 @@ class FileTest extends \Test\TestCase {
 	 * @expectedException \OCP\Files\NotPermittedException
 	 */
 	public function testFOpenReadNotPermitted() {
-		$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
-
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$hook = function ($file) {
 			throw new \Exception('Hooks are not supposed to be called');
 		};
@@ -345,8 +375,14 @@ class FileTest extends \Test\TestCase {
 	 * @expectedException \OCP\Files\NotPermittedException
 	 */
 	public function testFOpenReadWriteNoReadPermissions() {
-		$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
-
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$hook = function () {
 			throw new \Exception('Hooks are not supposed to be called');
 		};
@@ -364,8 +400,14 @@ class FileTest extends \Test\TestCase {
 	 * @expectedException \OCP\Files\NotPermittedException
 	 */
 	public function testFOpenReadWriteNoWritePermissions() {
-		$root = new \OC\Files\Node\Root($this->manager, new $this->view, $this->user, $this->userMountCache);
-
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			new $this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$hook = function () {
 			throw new \Exception('Hooks are not supposed to be called');
 		};
@@ -382,7 +424,7 @@ class FileTest extends \Test\TestCase {
 	public function testCopySameStorage() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->any())
@@ -415,7 +457,7 @@ class FileTest extends \Test\TestCase {
 	public function testCopyNotPermitted() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		/**
@@ -453,7 +495,7 @@ class FileTest extends \Test\TestCase {
 	public function testCopyNoParent() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->never())
@@ -475,7 +517,7 @@ class FileTest extends \Test\TestCase {
 	public function testCopyParentIsFile() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->never())
@@ -496,7 +538,7 @@ class FileTest extends \Test\TestCase {
 	public function testMoveSameStorage() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->any())
@@ -526,7 +568,7 @@ class FileTest extends \Test\TestCase {
 	public function testMoveNotPermitted() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->any())
@@ -553,7 +595,7 @@ class FileTest extends \Test\TestCase {
 	public function testMoveNoParent() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		/**
@@ -583,7 +625,7 @@ class FileTest extends \Test\TestCase {
 	public function testMoveParentIsFile() {
 		/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
 		$root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 
 		$this->view->expects($this->never())
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index e592013eb6a65f61947224cda3929a0c41db4184..dcfe6a1768cb3a9ea97781f5162a27216731cffc 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -18,11 +18,13 @@ use OC\Files\Node\Node;
 use OC\Files\Node\Root;
 use OC\Files\Storage\Temporary;
 use OC\Files\Storage\Wrapper\Jail;
+use OC\User\User;
 use OCP\Files\Mount\IMountPoint;
 use OCP\Files\NotFoundException;
-use OCP\Files\NotPermittedException;
 use OC\Files\View;
 use OCP\Files\Storage;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 /**
  * Class FolderTest
@@ -32,10 +34,14 @@ use OCP\Files\Storage;
  * @package Test\Files\Node
  */
 class FolderTest extends \Test\TestCase {
+	/** @var User */
 	private $user;
-
 	/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
 	private $userMountCache;
+	/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+	private $logger;
+	/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+	private $userManager;
 
 	protected function setUp() {
 		parent::setUp();
@@ -43,6 +49,8 @@ class FolderTest extends \Test\TestCase {
 		$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
 			->disableOriginalConstructor()
 			->getMock();
+		$this->logger = $this->createMock(ILogger::class);
+		$this->userManager = $this->createMock(IUserManager::class);
 	}
 
 	protected function getMockStorage() {
@@ -64,7 +72,7 @@ class FolderTest extends \Test\TestCase {
 		 */
 		$view = $this->createMock(View::class);
 		$root = $this->getMockBuilder(Root::class)
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
@@ -118,7 +126,14 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = new \OC\Files\Node\Root($manager, $view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$manager,
+			$view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$root->listen('\OC\Files', 'preDelete', $preListener);
 		$root->listen('\OC\Files', 'postDelete', $postListener);
 
@@ -150,7 +165,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -171,7 +188,7 @@ class FolderTest extends \Test\TestCase {
 		 */
 		$view = $this->createMock(View::class);
 		$root = $this->getMockBuilder(Root::class)
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
@@ -202,7 +219,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -221,7 +240,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -243,7 +264,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -263,7 +286,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -293,7 +318,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -313,7 +340,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -343,7 +372,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -363,7 +394,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -383,7 +416,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -431,8 +466,10 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getUser', 'getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -480,7 +517,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -528,7 +567,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -576,7 +617,9 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$root->expects($this->any())
 			->method('getUser')
 			->will($this->returnValue($this->user));
@@ -656,8 +699,10 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$storage = $this->createMock(\OC\Files\Storage\Storage::class);
 		$mount = new MountPoint($storage, '/bar');
 		$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock();
@@ -707,8 +752,10 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$storage = $this->createMock(\OC\Files\Storage\Storage::class);
 		$mount = new MountPoint($storage, '/bar');
 		$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([''])->getMock();
@@ -757,8 +804,10 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		$storage = $this->createMock(\OC\Files\Storage\Storage::class);
 		$mount1 = new MountPoint($storage, '/bar');
 		$mount2 = new MountPoint($storage, '/bar/foo/asd');
@@ -837,8 +886,10 @@ class FolderTest extends \Test\TestCase {
 		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
 		 */
 		$view = $this->createMock(View::class);
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getUser', 'getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 
 		$view->expects($this->any())
 			->method('file_exists')
@@ -863,8 +914,10 @@ class FolderTest extends \Test\TestCase {
 		 */
 		$view = $this->createMock(View::class);
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getUser', 'getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
 		$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
 			->disableOriginalConstructor()->getMock();
@@ -922,8 +975,10 @@ class FolderTest extends \Test\TestCase {
 		 */
 		$view = $this->createMock(View::class);
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getUser', 'getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
 		$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
 			->disableOriginalConstructor()->getMock();
@@ -979,8 +1034,10 @@ class FolderTest extends \Test\TestCase {
 		 */
 		$view = $this->createMock(View::class);
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
-		$root = $this->getMockBuilder(Root::class)->setMethods(['getUser', 'getMountsIn', 'getMount'])
-			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache])->getMock();
+		$root = $this->getMockBuilder(Root::class)
+			->setMethods(['getUser', 'getMountsIn', 'getMount'])
+			->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
+			->getMock();
 		/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
 		$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
 			->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php
index 013fcabf222f551a201b1d89a09c7e8908d35653..765bb647a1af2c837151813bf31b6c3ebdbc847e 100644
--- a/tests/lib/Files/Node/HookConnectorTest.php
+++ b/tests/lib/Files/Node/HookConnectorTest.php
@@ -13,6 +13,8 @@ use OC\Files\Node\Root;
 use OC\Files\Storage\Temporary;
 use OC\Files\View;
 use OCP\Files\Node;
+use OCP\ILogger;
+use OCP\IUserManager;
 use Test\TestCase;
 use Test\Traits\MountProviderTrait;
 use Test\Traits\UserTrait;
@@ -54,7 +56,9 @@ class HookConnectorTest extends TestCase {
 			Filesystem::getMountManager(),
 			$this->view,
 			\OC::$server->getUserManager()->get($this->userId),
-			\OC::$server->getUserMountCache()
+			\OC::$server->getUserMountCache(),
+			$this->createMock(ILogger::class),
+			$this->createMock(IUserManager::class)
 		);
 	}
 
diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php
index da753f833c27d058596ee68d8035238da3a17a2a..b5cd832d1dd34876d930476213b90d7038547beb 100644
--- a/tests/lib/Files/Node/IntegrationTest.php
+++ b/tests/lib/Files/Node/IntegrationTest.php
@@ -12,6 +12,8 @@ use OC\Files\Node\Root;
 use OC\Files\Storage\Temporary;
 use OC\Files\View;
 use OC\User\User;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 /**
  * Class IntegrationTest
@@ -47,7 +49,14 @@ class IntegrationTest extends \Test\TestCase {
 		$this->loginAsUser($user->getUID());
 
 		$this->view = new View();
-		$this->root = new Root($manager, $this->view, $user, \OC::$server->getUserMountCache());
+		$this->root = new Root(
+			$manager,
+			$this->view,
+			$user,
+			\OC::$server->getUserMountCache(),
+			$this->createMock(ILogger::class),
+			$this->createMock(IUserManager::class)
+		);
 		$storage = new Temporary(array());
 		$subStorage = new Temporary(array());
 		$this->storages[] = $storage;
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index b7e2f336a60f72696caad740924ba216efdac88a..1a3a0472e973c5b286b50679a4b905e18d805c9e 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -9,21 +9,24 @@
 namespace Test\Files\Node;
 
 use OC\Files\FileInfo;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 class NodeTest extends \Test\TestCase {
 	/** @var \OC\User\User */
 	private $user;
-
 	/** @var \OC\Files\Mount\Manager */
 	private $manager;
-
 	/** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */
 	private $view;
-
 	/** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject */
 	private $root;
 	/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
 	private $userMountCache;
+	/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+	private $logger;
+	/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+	private $userManager;
 
 	protected function setUp() {
 		parent::setUp();
@@ -34,9 +37,7 @@ class NodeTest extends \Test\TestCase {
 		$urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
 			->disableOriginalConstructor()
 			->getMock();
-
 		$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator);
-
 		$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
 			->disableOriginalConstructor()
 			->getMock();
@@ -46,8 +47,10 @@ class NodeTest extends \Test\TestCase {
 		$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
 			->disableOriginalConstructor()
 			->getMock();
+		$this->logger = $this->createMock(ILogger::class);
+		$this->userManager = $this->createMock(IUserManager::class);
 		$this->root = $this->getMockBuilder('\OC\Files\Node\Root')
-			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache])
+			->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
 			->getMock();
 	}
 
@@ -273,7 +276,14 @@ class NodeTest extends \Test\TestCase {
 			$hooksRun++;
 		};
 
-		$root = new \OC\Files\Node\Root($this->manager, $this->view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 		$root->listen('\OC\Files', 'preTouch', $preListener);
 		$root->listen('\OC\Files', 'postTouch', $postListener);
 
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index f42a42c42b103acf3be5de7cb20c281a7423eda0..fbc33cafcd87fca41887219c3f918331fda00e22 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -8,16 +8,31 @@
 
 namespace Test\Files\Node;
 
+use OC\Cache\CappedMemoryCache;
 use OC\Files\FileInfo;
+use OC\Files\Mount\Manager;
+use OC\Files\Node\Folder;
+use OC\Files\View;
+use OCP\ILogger;
+use OCP\IUser;
+use OCP\IUserManager;
 
+/**
+ * Class RootTest
+ *
+ * @package Test\Files\Node
+ */
 class RootTest extends \Test\TestCase {
 	/** @var \OC\User\User */
 	private $user;
-
 	/** @var \OC\Files\Mount\Manager */
 	private $manager;
 	/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
 	private $userMountCache;
+	/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+	private $logger;
+	/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+	private $userManager;
 
 	protected function setUp() {
 		parent::setUp();
@@ -30,13 +45,14 @@ class RootTest extends \Test\TestCase {
 			->getMock();
 
 		$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlgenerator);
-
 		$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
 			->disableOriginalConstructor()
 			->getMock();
 		$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
 			->disableOriginalConstructor()
 			->getMock();
+		$this->logger = $this->createMock(ILogger::class);
+		$this->userManager = $this->createMock(IUserManager::class);
 	}
 
 	protected function getFileInfo($data) {
@@ -56,7 +72,14 @@ class RootTest extends \Test\TestCase {
 		$view = $this->getMockBuilder('\OC\Files\View')
 			->disableOriginalConstructor()
 			->getMock();
-		$root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 
 		$view->expects($this->once())
 			->method('getFileInfo')
@@ -85,7 +108,14 @@ class RootTest extends \Test\TestCase {
 		$view = $this->getMockBuilder('\OC\Files\View')
 			->disableOriginalConstructor()
 			->getMock();
-		$root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 
 		$view->expects($this->once())
 			->method('getFileInfo')
@@ -106,7 +136,14 @@ class RootTest extends \Test\TestCase {
 		$view = $this->getMockBuilder('\OC\Files\View')
 			->disableOriginalConstructor()
 			->getMock();
-		$root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 
 		$root->get('/../foo');
 	}
@@ -121,8 +158,82 @@ class RootTest extends \Test\TestCase {
 		$view = $this->getMockBuilder('\OC\Files\View')
 			->disableOriginalConstructor()
 			->getMock();
-		$root = new \OC\Files\Node\Root($this->manager, $view, $this->user, $this->userMountCache);
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$view,
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
 
 		$root->get('/bar/foo');
 	}
+
+	public function testGetUserFolder() {
+		$root = new \OC\Files\Node\Root(
+			$this->manager,
+			$this->createMock(View::class),
+			$this->user,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
+		$user = $this->createMock(IUser::class);
+		$user
+			->expects($this->once())
+			->method('getUID')
+			->willReturn('MyUserId');
+		$this->userManager
+			->expects($this->once())
+			->method('get')
+			->with('MyUserId')
+			->willReturn($user);
+		/** @var CappedMemoryCache|\PHPUnit_Framework_MockObject_MockObject $cappedMemoryCache */
+		$cappedMemoryCache = $this->createMock(CappedMemoryCache::class);
+		$cappedMemoryCache
+			->expects($this->once())
+			->method('hasKey')
+			->willReturn(true);
+		$folder = $this->createMock(Folder::class);
+		$cappedMemoryCache
+			->expects($this->once())
+			->method('get')
+			->with('MyUserId')
+			->willReturn($folder);
+
+		$this->invokePrivate($root, 'userFolderCache', [$cappedMemoryCache]);
+		$this->assertEquals($folder, $root->getUserFolder('MyUserId'));
+	}
+
+	/**
+	 * @expectedException \OC\User\NoUserException
+	 * @expectedExceptionMessage Backends provided no user object
+	 */
+	public function testGetUserFolderWithNoUserObj() {
+		$root = new \OC\Files\Node\Root(
+			$this->createMock(Manager::class),
+			$this->createMock(View::class),
+			null,
+			$this->userMountCache,
+			$this->logger,
+			$this->userManager
+		);
+		$this->userManager
+			->expects($this->once())
+			->method('get')
+			->with('NotExistingUser')
+			->willReturn(null);
+		$this->logger
+			->expects($this->once())
+			->method('error')
+			->with(
+				'Backends provided no user object for NotExistingUser',
+				[
+					'app' => 'files',
+				]
+			);
+
+		$root->getUserFolder('NotExistingUser');
+	}
 }
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index 632895298436ca448fc8263056a25869cff1f8c1..d550ba158a985b25811831bc18f63054e3b4470f 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -20,6 +20,9 @@
 */
 
 namespace Test\Share;
+use OC\Share\Share;
+use OCP\ILogger;
+use OCP\IUserManager;
 
 /**
  * Class Test_Share
@@ -1631,6 +1634,31 @@ class ShareTest extends \Test\TestCase {
 			$this->assertEquals('Sharing failed, because the user ' . $this->user1 . ' is the original sharer', $e->getMessage());
 		}
 	}
+
+	/**
+	 * @expectedException \OC\User\NoUserException
+	 * @expectedExceptionMessage Backends provided no user object
+	 */
+	public function testGetUsersSharingFileWithException() {
+		$userManager = $this->createMock(IUserManager::class);
+		$logger = $this->createMock(ILogger::class);
+		$userManager
+			->expects($this->once())
+			->method('get')
+			->with('test')
+			->willReturn(null);
+		$logger
+			->expects($this->once())
+			->method('error')
+			->with(
+				'Backends provided no user object for test',
+				[
+					'app' => 'files',
+				]
+			);
+
+		Share::getUsersSharingFile('/my/file/path', 'test', $userManager, $logger);
+	}
 }
 
 class DummyShareClass extends \OC\Share\Share {