fill([ 'question' => 'Ancienne question ?', 'answer' => 'Ancienne réponse.', ]); $faq->saveOrFail(); $action = new UpdateFaq(); $input = new UpdateFaqInput( faq: $faq, question: 'Question mise à jour ?', answer: 'Réponse mise à jour.', ); // WHEN $updatedFaq = $action($input); // THEN expect($updatedFaq->id)->toBe($faq->id) ->and($updatedFaq->question)->toBe('Question mise à jour ?') ->and($updatedFaq->answer)->toBe('Réponse mise à jour.'); $fresh = Faq::query()->find($faq->id); expect($fresh)->not->toBeNull() ->and($fresh?->question)->toBe('Question mise à jour ?') ->and($fresh?->answer)->toBe('Réponse mise à jour.'); }); it('throws when an invalid input is passed', function (): void { // GIVEN $action = new UpdateFaq(); $invalidInput = new class () implements ActionInput { }; // WHEN expect( /** @phpstan-ignore argument.type */ fn () => $action($invalidInput) ) // THEN ->toThrow(\InvalidArgumentException::class); }); });