public function testLoginNonExisting() { $session = $this->getMock('\\OC\\Session\\Memory', array(), array('')); $session->expects($this->never())->method('set'); $session->expects($this->once())->method('regenerateId'); $manager = $this->getMock('\\OC\\User\\Manager'); $backend = $this->getMock('\\Test\\Util\\User\\Dummy'); $manager->expects($this->once())->method('checkPassword')->with('foo', 'bar')->will($this->returnValue(false)); $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config); $userSession->login('foo', 'bar'); }
/** * When using a device token, the loginname must match the one that was used * when generating the token on the browser. */ public function testLoginWithDifferentTokenLoginName() { $session = $this->getMock('\\OC\\Session\\Memory', array(), array('')); $manager = $this->getMock('\\OC\\User\\Manager'); $backend = $this->getMock('\\Test\\Util\\User\\Dummy'); $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config); $username = '******'; $token = new \OC\Authentication\Token\DefaultToken(); $token->setLoginName($username); $session->expects($this->never())->method('set'); $session->expects($this->once())->method('regenerateId'); $this->tokenProvider->expects($this->once())->method('getToken')->with('bar')->will($this->returnValue($token)); $manager->expects($this->once())->method('checkPassword')->with('foo', 'bar')->will($this->returnValue(false)); $userSession->login('foo', 'bar'); }
public function testLoginNonExisting() { $session = $this->getMock('\\OC\\Session\\Memory', array(), array('')); $session->expects($this->never())->method('set'); $manager = $this->getMock('\\OC\\User\\Manager'); $backend = $this->getMock('OC_User_Dummy'); $manager->expects($this->once())->method('checkPassword')->with('foo', 'bar')->will($this->returnValue(false)); $userSession = new \OC\User\Session($manager, $session); $userSession->login('foo', 'bar'); }
public function testLoginNonExisting() { /** @var ISession | \PHPUnit_Framework_MockObject_MockObject $session */ $session = $this->getMock('\\OC\\Session\\Memory', array(), array('')); $session->expects($this->never())->method('set'); $session->expects($this->once())->method('regenerateId'); /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject $manager */ $manager = $this->getMock('\\OC\\User\\Manager'); $manager->expects($this->once())->method('checkPassword')->with('foo', 'bar')->will($this->returnValue(false)); $userSession = new \OC\User\Session($manager, $session); $userSession->login('foo', 'bar'); }