ldc-cocotte/tests/Unit/Domain/Models/ValueObjects/IcsContentTest.php
Jérémy Munsch 0ae05e031d
feat(jobs): enhance SendMissingOrderReminderJob with ICS content generation
- Added IcsGeneratorService for generating ICS content.
- Updated MissingOrderReminderNotification to include cutoff date and ICS content.
- Refactored SendMissingOrderReminderJob to utilize new ICS generation logic.
- Introduced IcsContent value object for better ICS content handling.
- Added tests for new functionality in SendMissingOrderReminderJob and IcsGeneratorService.
2026-11-15 19:49:48 +01:00

37 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use Domain\Models\ValueObjects\IcsContent;
describe('IcsContent', function (): void {
it('creates a valid IcsContent value object and casts to string', function (): void {
// GIVEN
$raw = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nEND:VCALENDAR\r\n";
// WHEN
$ics = new IcsContent($raw);
// THEN
expect($ics->value)->toBe($raw)
->and((string) $ics)->toBe($raw);
});
it('rejects empty ICS content', function (): void {
// WHEN / THEN
expect(fn (): IcsContent => new IcsContent(' '))
->toThrow(\InvalidArgumentException::class);
});
it('rejects ICS content missing BEGIN:VCALENDAR header', function (): void {
// WHEN / THEN
expect(fn (): IcsContent => new IcsContent("BEGIN:VEVENT\r\nEND:VCALENDAR"))
->toThrow(\InvalidArgumentException::class);
});
it('rejects ICS content missing END:VCALENDAR footer', function (): void {
// WHEN / THEN
expect(fn (): IcsContent => new IcsContent("BEGIN:VCALENDAR\r\nBEGIN:VEVENT"))
->toThrow(\InvalidArgumentException::class);
});
});