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()); }
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(); }
/** * @param string $tokenId * @return string */ public function refreshToken($tokenId) { return $this->tokenManager->refreshToken($tokenId)->getValue(); }
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()); }