File: ConstraintViolationTest.php

package info (click to toggle)
php-lcobucci-jwt 5.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,280 kB
  • sloc: php: 6,674; makefile: 49
file content (23 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
declare(strict_types=1);

namespace Lcobucci\JWT\Tests\Validation;

use Lcobucci\JWT\Validation\Constraint\IdentifiedBy;
use Lcobucci\JWT\Validation\ConstraintViolation;
use PHPUnit\Framework\Attributes as PHPUnit;
use PHPUnit\Framework\TestCase;

#[PHPUnit\CoversClass(ConstraintViolation::class)]
#[PHPUnit\UsesClass(IdentifiedBy::class)]
final class ConstraintViolationTest extends TestCase
{
    #[PHPUnit\Test]
    public function errorShouldConfigureMessageAndConstraint(): void
    {
        $violation = ConstraintViolation::error('testing', new IdentifiedBy('token id'));

        self::assertSame('testing', $violation->getMessage());
        self::assertSame(IdentifiedBy::class, $violation->constraint);
    }
}