public function testTagManagerWithoutUserReturnsNull() { $this->userSession = $this->getMock('\OCP\IUserSession'); $this->userSession ->expects($this->any()) ->method('getUser') ->will($this->returnValue(null)); $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession); $this->assertNull($this->tagMgr->load($this->objectType)); }
protected function setUp() { parent::setUp(); OC_User::clearBackends(); OC_User::useBackend('dummy'); $userId = $this->getUniqueID('user_'); OC_User::createUser($userId, 'pass'); OC_User::setUserId($userId); $this->user = new OC\User\User($userId, null); $this->userSession = $this->getMock('\\OCP\\IUserSession'); $this->userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user)); $this->objectType = $this->getUniqueID('type_'); $this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDb()); $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession); }