public function setUp()
 {
     parent::setUp();
     $this->globalStoragesService = $this->service;
     $this->user = new \OC\User\User(self::USER_ID, null);
     /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject $userSession */
     $userSession = $this->getMock('\\OCP\\IUserSession');
     $userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->groupManager = $this->getMock('\\OCP\\IGroupManager');
     $this->groupManager->method('isInGroup')->will($this->returnCallback(function ($userId, $groupId) {
         if ($userId === self::USER_ID) {
             switch ($groupId) {
                 case self::GROUP_ID:
                 case self::GROUP_ID2:
                     return true;
             }
         }
         return false;
     }));
     $this->groupManager->method('getUserGroupIds')->will($this->returnCallback(function (IUser $user) {
         if ($user->getUID() === self::USER_ID) {
             return [self::GROUP_ID, self::GROUP_ID2];
         } else {
             return [];
         }
     }));
     $this->service = new UserGlobalStoragesService($this->backendService, $this->dbConfig, $userSession, $this->groupManager, $this->mountCache);
 }
 public function setUp()
 {
     parent::setUp();
     $this->globalStoragesService = $this->service;
     $this->user = new \OC\User\User(self::USER_ID, null);
     $userSession = $this->getMock('\\OCP\\IUserSession');
     $userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->groupManager = $this->getMock('\\OCP\\IGroupManager');
     $this->groupManager->method('isInGroup')->will($this->returnCallback(function ($userId, $groupId) {
         if ($userId === self::USER_ID && $groupId === self::GROUP_ID) {
             return true;
         }
         return false;
     }));
     $this->service = new UserGlobalStoragesService($this->backendService, $userSession, $this->groupManager);
 }