title)->toBe($title) ->and($seo->description)->toBe($description); }); it('throws when title is empty', function (): void { // GIVEN $emptyTitle = ' '; $description = 'Description valide'; // WHEN expect(fn () => new SeoMetadata(title: $emptyTitle, description: $description)) // THEN ->toThrow(\InvalidArgumentException::class); }); it('throws when title exceeds 255 characters', function (): void { // GIVEN $tooLongTitle = str_repeat('a', 256); $description = 'Description valide'; // WHEN expect(fn () => new SeoMetadata(title: $tooLongTitle, description: $description)) // THEN ->toThrow(\InvalidArgumentException::class); }); it('throws when description is empty', function (): void { // GIVEN $title = 'Titre valide'; $emptyDescription = ' '; // WHEN expect(fn () => new SeoMetadata(title: $title, description: $emptyDescription)) // THEN ->toThrow(\InvalidArgumentException::class); }); it('throws when description exceeds 500 characters', function (): void { // GIVEN $title = 'Titre valide'; $tooLongDescription = str_repeat('a', 501); // WHEN expect(fn () => new SeoMetadata(title: $title, description: $tooLongDescription)) // THEN ->toThrow(\InvalidArgumentException::class); }); });