In this last lesson, we will have another test for Quizzes form.
As always we need a factory.
php artisan make:factory QuizFactory
database/factories/QuizFactory.php:
use Illuminate\Support\Str; class QuizFactory extends Factory{ public function definition(): array { $title = $this->faker->sentence(); $slug = Str::slug($title); return [ 'title' => $title, 'slug' => $slug, 'description' => fake()->paragraph(), 'published' => false, 'public' => false, ]; }}
And the feature test...