I'm using I'm wanting to migrate the database once, and then in every test class use the DatabaseTransactions trait.
I have a custom command that I call to migrate the database, which I currently have in the setUp
method of my applications tests/TestCase
class.
I don't want to migrate the database before every test, I want to use transactions. However, I'm not sure how to run the migration once before the entire test suite runs.
The closest thing I could come up with is the setUpBeforeClass
static method that will run once before the first test runs.
public static function setUpBeforeClass()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
$app[Kernel::class]->call('migrate-custom');
}
but when I do that, the database is non-existent when the tests run.
Any ideas?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire