toBeInstanceOf(Period::class) ->and($period->start)->toBe($start) ->and($period->end)->toBe($end); }); it('accepts a period whose end equals its start', function (): void { // GIVEN $start = new DateTime('2026-01-01'); $end = new DateTime('2026-01-01'); // WHEN $period = new Period($start, $end); // THEN expect($period->start)->toBe($start) ->and($period->end)->toBe($end); }); it('throws when the end is before the start', function (): void { // GIVEN / WHEN / THEN expect(fn (): Period => new Period(new DateTime('2026-02-01'), new DateTime('2026-01-01'))) ->toThrow(\DomainException::class, 'Period end date cannot be before its start date.'); }); });