|
|
|
@ -4,7 +4,6 @@ use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
|
|
use BradyMcD\TAATP\AntiCSRF\Base as BaseAntiCSRF;
|
|
|
|
use BradyMcD\TAATP\AntiCSRF\Base as BaseAntiCSRF;
|
|
|
|
use BradyMcD\TAATP\Session\Base as BaseSession;
|
|
|
|
use BradyMcD\TAATP\Session\Base as BaseSession;
|
|
|
|
use DateTimeImmutable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final class TestClock implements \Psr\Clock\ClockInterface
|
|
|
|
final class TestClock implements \Psr\Clock\ClockInterface
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -20,9 +19,10 @@ final class TestClock implements \Psr\Clock\ClockInterface
|
|
|
|
self::$time = $time;
|
|
|
|
self::$time = $time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function now(): DateTimeImmutable
|
|
|
|
/** @SuppressWarnings(PHPMD.MissingImport) */
|
|
|
|
|
|
|
|
function now(): \DateTimeImmutable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (new DateTimeImmutable())->setTimestamp(self::$time);
|
|
|
|
return (new \DateTimeImmutable())->setTimestamp(self::$time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -80,7 +80,7 @@ final class AntiCSRFTest extends TestCase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self::$clock->setTime(self::$clock->now()->getTimestamp() + 3600);
|
|
|
|
self::$clock->setTime(self::$clock->now()->getTimestamp() + 3600);
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertFalse(self::$AntiCSRF->match());
|
|
|
|
$this->assertFalse(self::$antiCSRF->match());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|