Closed frdteknikelektro closed 6 years ago
How is exactly best practice to migrate and seed database before test? not every test.
After more investigations, the problem is happens because I override refreshTestDatabase()
to run command migrate:fresh --seed
, if I remove the --seed, it works. Is this intended?
protected function refreshTestDatabase()
{
if (! RefreshDatabaseState::$migrated) {
$this->artisan('migrate:fresh', [ '--seed' => true ]);
$this->app[Kernel::class]->setArtisan(null);
RefreshDatabaseState::$migrated = true;
}
$this->beginDatabaseTransaction();
}
Aaand the problem is happen because of I install voyager package. and there were some strange line of code on seeder on MenuItemsTableSeeder.php#L17. If I comment this line, no issue happens
Then I'm going to close this.
Description:
I running test but always failed at first route() function, but after that is working, here all test consist route(), but the first one always fail.
Steps To Reproduce:
On tests/Feature/ExampleTest.php edit to became
Then run
I know this should be failed of unauthenticated, but it failed on different case. This is happen when I use RefreshDatabase Trait on TestCase Class.