Skip to content

Commit

Permalink
fix test assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
freebuu authored and lcobucci committed Apr 11, 2024
1 parent 5be1d16 commit 8f564c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/Validation/Constraint/HasClaimTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,24 @@ public static function registeredClaims(): iterable
/** @test */
public function assertShouldRaiseExceptionWhenClaimIsNotSet(): void
{
$constraint = new HasClaim('claimId');

$this->expectException(ConstraintViolation::class);
$this->expectExceptionMessage('The token does not have the claim "claimId"');

$constraint = new HasClaim('claimId');
$constraint->assert($this->buildToken());
}

/** @test */
public function assertShouldRaiseExceptionWhenTokenIsNotAPlainToken(): void
{
$token = $this->createMock(Token::class);
$constraint = new HasClaim('claimId');

$this->expectException(ConstraintViolation::class);
$this->expectExceptionMessage('You should pass a plain token');

$constraint = new HasClaim('claimId');
$constraint->assert($this->createMock(Token::class));
$constraint->assert($token);
}

/** @test */
Expand Down

0 comments on commit 8f564c6

Please sign in to comment.