File tree Expand file tree Collapse file tree
tests/Validation/Constraint Expand file tree Collapse file tree Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments