Related to https://github.com/phpmyadmin/phpmyadmin/pull/20030 Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
27 lines
531 B
PHP
27 lines
531 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Tests\Clock;
|
|
|
|
use DateTimeImmutable;
|
|
use Psr\Clock\ClockInterface;
|
|
|
|
final class MockClock implements ClockInterface
|
|
{
|
|
public function __construct(public DateTimeImmutable $now)
|
|
{
|
|
}
|
|
|
|
public function now(): DateTimeImmutable
|
|
{
|
|
return clone $this->now;
|
|
}
|
|
|
|
/** @param non-empty-string $dateTime */
|
|
public static function from(string $dateTime = 'now'): ClockInterface
|
|
{
|
|
return new self(new DateTimeImmutable($dateTime));
|
|
}
|
|
}
|