mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
20 lines
749 B
PHP
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']);
|
|
});
|