Files
pterodactyl-panel/tests/Unit/Extensions/Lcobucci/JWT/Encoding/TimestampDatesTest.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

20 lines
749 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Tests\Pest\Unit\Extensions\Lcobucci\JWT\Encoding\TimestampDatesTest;
use DateTimeImmutable;
use Pterodactyl\Extensions\Lcobucci\JWT\Encoding\TimestampDates;
use UnexpectedValueException;
test('formats registered date claims as unix timestamps', function () {
$claims = (new TimestampDates())->formatClaims(['iat' => new DateTimeImmutable('@1700000000'), 'server' => ['uuid' => 'example']]);
expect($claims['iat'])->toBe(1700000000);
expect($claims['server'])->toBe(['uuid' => 'example']);
});
test('rejects non date registered claims', function () {
$this->expectException(UnexpectedValueException::class);
(new TimestampDates())->formatClaims(['exp' => 'tomorrow']);
});