make(Kernel::class);
/*
* Bootstrap the kernel and prepare application for testing.
*/
$kernel->bootstrap();
// Register the collision service provider so that errors during the test
// setup process are output nicely.
(new Provider)->register();
$output = new ConsoleOutput;
if (config('database.default') !== 'testing') {
$output->writeln(PHP_EOL . 'Cannot run test process against non-testing database.');
$output->writeln(PHP_EOL . 'Environment is currently pointed at: "' . config('database.default') . '".');
exit(1);
}
/*
* Perform database migrations and reseeding before continuing with
* running the tests.
*/
if (! env('SKIP_MIGRATIONS')) {
$output->writeln(PHP_EOL . 'Refreshing database for Integration tests...');
$kernel->call('migrate:fresh', ['--database' => 'testing']);
$output->writeln('Seeding database for Integration tests...' . PHP_EOL);
$kernel->call('db:seed', ['--database' => 'testing']);
} else {
$output->writeln(PHP_EOL . 'Skipping database migrations...' . PHP_EOL);
}