예제 #1
0
 public function testResetFormUnsuccessful()
 {
     $userId = 'admin';
     $token = 'MySecretToken';
     $this->urlGenerator->expects($this->once())->method('linkToRouteAbsolute')->with('core.lost.setPassword', array('userId' => 'admin', 'token' => 'MySecretToken'))->will($this->returnValue('https://ownCloud.com/index.php/lostpassword/'));
     $response = $this->lostController->resetform($token, $userId);
     $expectedResponse = new TemplateResponse('core', 'lostpassword/resetpassword', array('link' => 'https://ownCloud.com/index.php/lostpassword/'), 'guest');
     $this->assertEquals($expectedResponse, $response);
 }
예제 #2
0
 public function testResetFormValidToken()
 {
     $userId = 'ValidTokenUser';
     $token = '12345:TheOnlyAndOnlyOneTokenToResetThePassword';
     $user = $this->getMockBuilder('\\OCP\\IUser')->disableOriginalConstructor()->getMock();
     $user->expects($this->once())->method('getLastLogin')->will($this->returnValue(12344));
     $this->userManager->expects($this->once())->method('get')->with('ValidTokenUser')->will($this->returnValue($user));
     $this->timeFactory->expects($this->once())->method('getTime')->will($this->returnValue(12348));
     $userId = 'ValidTokenUser';
     $token = 'TheOnlyAndOnlyOneTokenToResetThePassword';
     $this->config->expects($this->once())->method('getUserValue')->with('ValidTokenUser', 'owncloud', 'lostpassword', null)->will($this->returnValue('12345:TheOnlyAndOnlyOneTokenToResetThePassword'));
     $this->urlGenerator->expects($this->once())->method('linkToRouteAbsolute')->with('core.lost.setPassword', array('userId' => 'ValidTokenUser', 'token' => 'TheOnlyAndOnlyOneTokenToResetThePassword'))->will($this->returnValue('https://ownCloud.com/index.php/lostpassword/'));
     $response = $this->lostController->resetform($token, $userId);
     $expectedResponse = new TemplateResponse('core', 'lostpassword/resetpassword', array('link' => 'https://ownCloud.com/index.php/lostpassword/'), 'guest');
     $this->assertEquals($expectedResponse, $response);
 }