PHPUnit – Seeding inside your test methods

If you want to run seeders before each test you can use the artisan command in each of your test methods.

Running all seeders with:

$this->artisan('db:seed');

Running only one specific seeder:

$this->artisan('db:seed', ['--class' => 'RolesTableSeeder']);

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.