test(compare): trace deterministic monthly seed progression

This commit is contained in:
2026-08-03 18:57:01 +00:00
parent 3b2fd1082f
commit f16a6b6880
23 changed files with 1274 additions and 213 deletions
+22 -1
View File
@@ -7,6 +7,19 @@ use phpDocumentor\Reflection\Types\Boolean;
class TimeUtil
{
private static function comparisonNow(): ?\DateTimeImmutable
{
$comparisonNow = getenv('REF_COMPARISON_NOW');
if (
getenv('REF_DETERMINISTIC_INSTALL_ENABLED') !== '1'
|| !is_string($comparisonNow)
|| $comparisonNow === ''
) {
return null;
}
return new \DateTimeImmutable($comparisonNow);
}
/** @deprecated */
public static function DateToday()
{
@@ -87,7 +100,7 @@ class TimeUtil
public static function now(bool $withFraction = false): string
{
$obj = new \DateTime();
$obj = static::comparisonNow() ?? new \DateTimeImmutable();
return static::format($obj, $withFraction);
}
@@ -182,11 +195,19 @@ class TimeUtil
}
public static function nowDateTime(): \DateTime{
$comparisonNow = static::comparisonNow();
if ($comparisonNow !== null) {
return \DateTime::createFromImmutable($comparisonNow);
}
$now = time();
return static::secondsToDateTime($now, false, true);
}
public static function nowDateTimeImmutable(): \DateTimeImmutable{
$comparisonNow = static::comparisonNow();
if ($comparisonNow !== null) {
return $comparisonNow;
}
$now = time();
return static::secondsToDateTime($now, true, true);
}