In the next lessons, we will use built-in Livewire testing tools to test Livewire components.

The first one will be for the Questions, so first we need the Question factory.
php artisan make:factory QuestionFactory
database/factories/QuestionFactory.php:
class QuestionFactory extends Factory{ public function definition(): array { return [ 'question_text' => fake()->paragraph(), ]; }}
Because Questions needs an option we need to create a factory for the QuestionOption Model...
Hello! can you explain how works more explicit these tests please? maybe the third one. Thank you.
Which part exactly is unclear to you?
actingAs()save()method on the component, we assert that the database has a new record.For more about testing with Livewire: https://laravel-livewire.com/docs/2.x/testing
If you want to learn testing from scratch, my course: Laravel Testing For Beginners: PHPUnit, Pest, TDD