setStartDate('01/10/2026'); $line->setEndDate(''); $line->setExpectedEndDate('15/10/2026'); $line->setService('LDCCAV030'); // THEN expect($line->startDate->format('Y-m-d'))->toBe('2026-10-01') ->and($line->endDate)->toBeNull() ->and($line->expectedEndDate)->toBeInstanceOf(\DateTimeImmutable::class) ->and($line->expectedEndDate?->format('Y-m-d'))->toBe('2026-10-15') ->and($line->service)->toBe('030'); }); it('throws when mandatory start date has invalid format', function (): void { // GIVEN $line = new EmployeeCsvImportLineService(); // WHEN + THEN expect(fn () => $line->setStartDate('2026-10-01')) ->toThrow(\InvalidArgumentException::class, 'Invalid date format: 2026-10-01'); }); it('throws when optional end date has invalid format', function (): void { // GIVEN $line = new EmployeeCsvImportLineService(); // WHEN + THEN expect(fn () => $line->setEndDate('2026-12-31')) ->toThrow(\InvalidArgumentException::class, 'Invalid date format: 2026-12-31'); }); });