Beispiel #1
0
 public function refresh(Token $token) : Token
 {
     $newToken = new Token(Uuid::uuid4(), $this->generatePassCode(), $token->getUserUuid(), $this->generateExpires());
     $this->tokenRepository->create($newToken);
     $this->tokenRepository->delete($token);
     return $newToken;
 }
 public function it_can_delete_a_token(Token $token, \PDOStatement $statement)
 {
     $token->getUuid()->willReturn($uuid = Uuid::uuid4());
     $this->pdo->prepare(new Argument\Token\StringContainsToken('DELETE FROM tokens'))->willReturn($statement);
     $statement->execute(['token_uuid' => $uuid->getBytes()])->shouldBeCalled();
     $this->delete($token);
 }
 public function it_can_refresh_a_token(Token $token)
 {
     $token->getUserUuid()->willReturn($userUuid = Uuid::uuid4());
     $this->tokenRepository->create(new Argument\Token\TypeToken(Token::class));
     $this->tokenRepository->delete($token);
     $newToken = $this->refresh($token);
     $newToken->shouldHaveType(Token::class);
     $newToken->getUserUuid()->shouldReturn($userUuid);
 }
Beispiel #4
0
 public function delete(Token $token)
 {
     $this->executeSql('
         DELETE FROM tokens WHERE token_uuid = :token_uuid
     ', ['token_uuid' => $token->getUuid()->getBytes()]);
 }