From f0e3f0e4741875abd9c57a4f95e472f9de0612df Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 25 Jun 2020 21:21:05 -0700 Subject: [PATCH] Make quick iteration testing easier --- bootstrap/tests.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bootstrap/tests.php b/bootstrap/tests.php index 276786610..c1a6c8fb0 100644 --- a/bootstrap/tests.php +++ b/bootstrap/tests.php @@ -17,12 +17,22 @@ $kernel->bootstrap(); $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. */ -$output->writeln(PHP_EOL . 'Refreshing database for Integration tests...'); -$kernel->call('migrate:fresh', ['--database' => 'testing']); +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']); + $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); +}