Skip to content

Commit 8f564c6

Browse files
freebuulcobucci
authored andcommitted
fix test assertion
1 parent 5be1d16 commit 8f564c6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/Validation/Constraint/HasClaimTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,24 @@ public static function registeredClaims(): iterable
4747
/** @test */
4848
public function assertShouldRaiseExceptionWhenClaimIsNotSet(): void
4949
{
50+
$constraint = new HasClaim('claimId');
51+
5052
$this->expectException(ConstraintViolation::class);
5153
$this->expectExceptionMessage('The token does not have the claim "claimId"');
5254

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

5758
/** @test */
5859
public function assertShouldRaiseExceptionWhenTokenIsNotAPlainToken(): void
5960
{
61+
$token = $this->createMock(Token::class);
62+
$constraint = new HasClaim('claimId');
63+
6064
$this->expectException(ConstraintViolation::class);
6165
$this->expectExceptionMessage('You should pass a plain token');
6266

63-
$constraint = new HasClaim('claimId');
64-
$constraint->assert($this->createMock(Token::class));
67+
$constraint->assert($token);
6568
}
6669

6770
/** @test */

0 commit comments

Comments
 (0)