From 9b8b96d6d4e571eec5bc32529a28cd5e692e4d1b Mon Sep 17 00:00:00 2001 From: Ashley Allen Date: Sun, 18 Apr 2021 01:04:47 +0100 Subject: [PATCH] Added the migrations to the base test case. --- tests/Unit/TestCase.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 3a226e9..9dd78bd 100755 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -49,5 +49,27 @@ protected function getEnvironmentSetUp($app) 'driver' => 'sqlite', 'database' => ':memory:', ]); + + $this->migrateDatabase(); + } + + /** + * Include each of the migrations and migrate them to + * finish preparing the database for running the + * tests. + */ + private function migrateDatabase(): void + { + include_once __DIR__.'/../../database/migrations/2019_12_22_015115_create_short_urls_table.php'; + include_once __DIR__.'/../../database/migrations/2019_12_22_015214_create_short_url_visits_table.php'; + include_once __DIR__.'/../../database/migrations/2020_02_11_224848_update_short_url_table_for_version_two_zero_zero.php'; + include_once __DIR__.'/../../database/migrations/2020_02_12_008432_update_short_url_visits_table_for_version_two_zero_zero.php'; + include_once __DIR__.'/../../database/migrations/2020_04_10_224546_update_short_url_table_for_version_three_zero_zero.php'; + + (new \CreateShortUrlsTable)->up(); + (new \CreateShortUrlVisitsTable)->up(); + (new \UpdateShortURLTableForVersionTwoZeroZero)->up(); + (new \UpdateShortURLVisitsTableForVersionTwoZeroZero)->up(); + (new \UpdateShortURLTableForVersionThreeZeroZero)->up(); } }