Simplify testing process for integration tests, don't require second connection
This commit is contained in:
parent
8c63eebf13
commit
66da520e11
5 changed files with 22 additions and 55 deletions
|
@ -22,9 +22,10 @@ $kernel->bootstrap();
|
|||
|
||||
$output = new ConsoleOutput();
|
||||
|
||||
if (config('database.default') !== 'testing') {
|
||||
$prefix = 'database.connections.' . config('database.default');
|
||||
if (config("$prefix.database") !== 'panel_test') {
|
||||
$output->writeln(PHP_EOL . '<error>Cannot run test process against non-testing database.</error>');
|
||||
$output->writeln(PHP_EOL . '<error>Environment is currently pointed at: "' . config('database.default') . '".</error>');
|
||||
$output->writeln(PHP_EOL . '<error>Environment is currently pointed at: "' . config("$prefix.database") . '".</error>');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -34,10 +35,10 @@ if (config('database.default') !== 'testing') {
|
|||
*/
|
||||
if (!env('SKIP_MIGRATIONS')) {
|
||||
$output->writeln(PHP_EOL . '<info>Refreshing database for Integration tests...</info>');
|
||||
$kernel->call('migrate:fresh', ['--database' => 'testing']);
|
||||
$kernel->call('migrate:fresh');
|
||||
|
||||
$output->writeln('<info>Seeding database for Integration tests...</info>' . PHP_EOL);
|
||||
$kernel->call('db:seed', ['--database' => 'testing']);
|
||||
$kernel->call('db:seed');
|
||||
} else {
|
||||
$output->writeln(PHP_EOL . '<comment>Skipping database migrations...</comment>' . PHP_EOL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue