question)->toBe($question) ->and($input->answer)->toBe($answer); }); }); describe('CreateFaqInput validation rules', function (): void { it('throws when question is empty or too short', function (string $invalidQuestion): void { // GIVEN $answer = 'Une réponse valide.'; // WHEN expect(fn () => new CreateFaqInput(question: $invalidQuestion, answer: $answer)) // THEN ->toThrow(\InvalidArgumentException::class); })->with(['', ' ', 'abc']); it('throws when question exceeds 255 characters', function (): void { // GIVEN $question = str_repeat('a', 256); $answer = 'Une réponse valide.'; // WHEN expect(fn () => new CreateFaqInput(question: $question, answer: $answer)) // THEN ->toThrow(\InvalidArgumentException::class); }); it('throws when answer is empty or too short', function (string $invalidAnswer): void { // GIVEN $question = 'Une question valide ?'; // WHEN expect(fn () => new CreateFaqInput(question: $question, answer: $invalidAnswer)) // THEN ->toThrow(\InvalidArgumentException::class); })->with(['', ' ', 'abc']); });