From b9c47ecd304c961433c1c718f7b1743aa3a2574b Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Sun, 8 May 2022 16:27:15 +0100 Subject: [PATCH 1/2] Make discord tag factory more unique --- database/factories/DiscordTagFactory.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database/factories/DiscordTagFactory.php b/database/factories/DiscordTagFactory.php index c38d3ed6..b7df0603 100644 --- a/database/factories/DiscordTagFactory.php +++ b/database/factories/DiscordTagFactory.php @@ -4,7 +4,6 @@ use App\Models\DiscordTag; use Illuminate\Database\Eloquent\Factories\Factory; -use Str; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DiscordTag> @@ -21,7 +20,7 @@ class DiscordTagFactory extends Factory public function definition() { return [ - 'tag' => sprintf('@%s', $this->faker->unique()->word()), + 'tag' => sprintf('@%s', $this->faker->unique()->numberBetween(0, PHP_INT_MAX)), 'description' => $this->faker->sentence(4), ]; } From 72514c1402ac1680162d040931b3fbf197f489c9 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Sun, 8 May 2022 16:31:59 +0100 Subject: [PATCH 2/2] Use RefreshDatabase --- tests/TestCase.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a6..a7a7f526 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,9 +2,23 @@ namespace Tests; +use DB; +use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { - use CreatesApplication; + use CreatesApplication, RefreshDatabase; + + public function beforeRefreshingDatabase() + { + DB::table('discord_notifications')->delete(); + DB::table('flow_measures')->delete(); + DB::table('events')->delete(); + DB::table('flight_information_regions')->delete(); + DB::table('users')->delete(); + DB::table('airport_groups')->delete(); + DB::table('airports')->delete(); + DB::table('discord_tags')->delete(); + } }