I have just used Laravel Permission plugin with Laravel 8, and now, I need to seed 3 tables before each tests Roles, Permissions:
Without this, my functional tests run in 57 secs.
After including seeding of those 2 tables in setUp()
method, test runs in 3 minutes and 8 seconds :(
public function setUp(): void
{
// first include all the normal setUp operations
parent::setUp();
// $this->withoutExceptionHandling();
// create roles and assign existing permissions
$this->seed('RoleTableSeeder');
$this->seed('PermissionTableSeeder');
$this->company = Company::factory()->create();
$this->operation = Operation::factory()->create(['company_id' => 1]);
$this->user = User::factory()->create(
[
'email' => 'ju@su.com',
'company_id' => 1,
'operation_id' => 1,
]);
$this->user->assignRole(User::SUPER_ADMIN);
$this->actingAs($this->user);
}
Is there a way to initially seed my 3 tables, so that it doesn't seed for each test, so that it doesn't take too long ?
Aucun commentaire:
Enregistrer un commentaire