コード例 #1
0
 public function testRefreshTokenAlwaysReturnsNewToken()
 {
     $this->storage->expects($this->never())->method('hasToken');
     $this->generator->expects($this->once())->method('generateToken')->will($this->returnValue('TOKEN'));
     $this->storage->expects($this->once())->method('setToken')->with('token_id', 'TOKEN');
     $token = $this->manager->refreshToken('token_id');
     $this->assertInstanceOf('Symfony\\Component\\Security\\Csrf\\CsrfToken', $token);
     $this->assertSame('token_id', $token->getId());
     $this->assertSame('TOKEN', $token->getValue());
 }
コード例 #2
0
 function it_should_refresh_the_value_of_a_token(CsrfTokenManager $tokenManager, CsrfToken $token)
 {
     $tokenManager->refreshToken('_csrf_login')->willReturn($token);
     $this->beConstructedWith($tokenManager);
     $this->refreshToken('_csrf_login');
     $token->getValue()->shouldHaveBeenCalled();
 }
コード例 #3
0
 /**
  * @param string $tokenId
  * @return string
  */
 public function refreshToken($tokenId)
 {
     return $this->tokenManager->refreshToken($tokenId)->getValue();
 }
コード例 #4
0
ファイル: UserHandlerTest.php プロジェクト: robbert-vdh/bolt
 public function testToken()
 {
     $app = $this->getApp();
     $handler = new UserHandler($app);
     $tokenManager = new CsrfTokenManager(null, new SessionTokenStorage(new Session(new MockArraySessionStorage())));
     $app['csrf'] = $tokenManager;
     $token = $tokenManager->refreshToken('bolt');
     $this->assertSame($token->getValue(), $handler->token()->getValue());
 }