chore: code cleanup

This commit is contained in:
fromme committed 2026-09-17 16:10:34 +02:00
1 parent 1a3640b15c
commit 5a01054b0e
65 files changed
+1046 -795

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Tests\Config;
use App\Config\BookingHorizon;
use PHPUnit\Framework\TestCase;
class BookingHorizonTest extends TestCase
{
public function testTheHorizonIsThreeMonthsFromTheGivenDay(): void
{
self::assertSame(
'2026-12-14',
BookingHorizon::latest(new \DateTimeImmutable('2026-09-14'))->format('Y-m-d'),
);
}
/**
* PHP's "+3 months" from a 31st overflows into the next month (31 November does not exist,
* so it becomes 1 December). Pinned rather than clamped: this is a cap, and one extra day of
* horizon four times a year is not worth the arithmetic it would take to remove. The
* recurrence code deliberately avoids months for exactly this reason -- see
* RecurrenceRule::intervalDays() -- but a single boundary can live with it.
*/
public function testAMonthEndOverflowsByADayAndThatIsAccepted(): void
{
self::assertSame(
'2026-12-01',
BookingHorizon::latest(new \DateTimeImmutable('2026-08-31'))->format('Y-m-d'),
);
}
public function testTheTimePartIsDroppedSoTheComparisonIsPerDay(): void
{
self::assertSame(
'00:00:00',
BookingHorizon::latest(new \DateTimeImmutable('2026-09-14 17:42:13'))->format('H:i:s'),
);
}
public function testItDefaultsToToday(): void
{
self::assertEquals(
BookingHorizon::latest(new \DateTimeImmutable('today')),
BookingHorizon::latest(),
);
}
}