OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
lcobucci
/
jwt
/
test
/
unit
/
Validation
/
Constraint
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:36:32 AM
rwxr-xr-x
📄
ConstraintTestCase.php
685 bytes
08/12/2024 10:36:32 AM
rw-r--r--
📄
IdentifiedByTest.php
1.97 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
IssuedByTest.php
2.63 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
PermittedForTest.php
2.65 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
RelatedToTest.php
2.01 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
SignedWithTest.php
3.89 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
ValidAtTest.php
6.74 KB
08/12/2024 10:36:32 AM
rw-r--r--
Editing: RelatedToTest.php
Close
<?php declare(strict_types=1); namespace Lcobucci\JWT\Validation\Constraint; use Lcobucci\JWT\Token\RegisteredClaims; use Lcobucci\JWT\Validation\ConstraintViolation; /** @coversDefaultClass \Lcobucci\JWT\Validation\Constraint\RelatedTo */ final class RelatedToTest extends ConstraintTestCase { /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldRaiseExceptionWhenSubjectIsNotSet(): void { $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is not related to the expected subject'); $constraint = new RelatedTo('user-auth'); $constraint->assert($this->buildToken()); } /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldRaiseExceptionWhenSubjectDoesNotMatch(): void { $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is not related to the expected subject'); $constraint = new RelatedTo('user-auth'); $constraint->assert($this->buildToken([RegisteredClaims::SUBJECT => 'password-recovery'])); } /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldNotRaiseExceptionWhenSubjectMatches(): void { $token = $this->buildToken([RegisteredClaims::SUBJECT => 'user-auth']); $constraint = new RelatedTo('user-auth'); $constraint->assert($token); $this->addToAssertionCount(1); } }