function it_should_update_token_after_failed_validation_when_the_option_is_set_to_true(TokenProvider $provider) { $tokenId = '_login_csrf_token'; $token = 'e95b24c1586e4b3dbfadcdd85aee46e0'; $this->beConstructedWith(['tokenProvider' => $provider, 'tokenId' => $tokenId, 'updateToken' => true]); $provider->isTokenValid($tokenId, $token)->willReturn(false); $provider->refreshToken($tokenId)->shouldBeCalled(); $isValid = $this->isValid($token); $isValid->shouldBe(false); $this->getMessages()->shouldHaveCount(1); }
/** * Refresh token if 'updateToken' flag is set to true */ protected function refreshToken() { if ($this->updateToken) { $this->tokenProvider->refreshToken($this->tokenId); } }