Skip to content

Commit f0e3f0e

Browse files
committed
Make quick iteration testing easier
1 parent da39d91 commit f0e3f0e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

bootstrap/tests.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@
1717

1818
$output = new ConsoleOutput;
1919

20+
if (config('database.default') !== 'testing') {
21+
$output->writeln(PHP_EOL . '<error>Cannot run test process against non-testing database.</error>');
22+
$output->writeln(PHP_EOL . '<error>Environment is currently pointed at: "' . config('database.default') . '".</error>');
23+
exit(1);
24+
}
25+
2026
/*
2127
* Perform database migrations and reseeding before continuing with
2228
* running the tests.
2329
*/
24-
$output->writeln(PHP_EOL . '<comment>Refreshing database for Integration tests...</comment>');
25-
$kernel->call('migrate:fresh', ['--database' => 'testing']);
26-
27-
$output->writeln('<comment>Seeding database for Integration tests...</comment>' . PHP_EOL);
28-
$kernel->call('db:seed', ['--database' => 'testing']);
30+
if (!env('SKIP_MIGRATIONS')) {
31+
$output->writeln(PHP_EOL . '<info>Refreshing database for Integration tests...</info>');
32+
$kernel->call('migrate:fresh', ['--database' => 'testing']);
33+
34+
$output->writeln('<info>Seeding database for Integration tests...</info>' . PHP_EOL);
35+
$kernel->call('db:seed', ['--database' => 'testing']);
36+
} else {
37+
$output->writeln(PHP_EOL . '<comment>Skipping database migrations...</comment>' . PHP_EOL);
38+
}

0 commit comments

Comments
 (0)