From b783f312f57c6b16e9d998a74c8e55f5bb3cfdab Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Tue, 7 Jan 2025 07:10:01 -0500 Subject: [PATCH] fix: add support for "Alpha Zombies" (#1558) --- app/Support/Gametype/GametypeHelper.php | 8 ++++++++ tests/Feature/Console/RefreshOverviewsTest.php | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/app/Support/Gametype/GametypeHelper.php b/app/Support/Gametype/GametypeHelper.php index e3c5948e..4ed9fe17 100644 --- a/app/Support/Gametype/GametypeHelper.php +++ b/app/Support/Gametype/GametypeHelper.php @@ -76,6 +76,14 @@ public static function findBaseGametype(string $name): BaseGametype return BaseGametype::MINI_GAME(); } + $infectionGameModes = [ + 'Zombies', + ]; + + if (Str::contains($name, $infectionGameModes, true)) { + return BaseGametype::INFECTION(); + } + throw new \InvalidArgumentException("Unable to find base gametype for: {$name}"); } } diff --git a/tests/Feature/Console/RefreshOverviewsTest.php b/tests/Feature/Console/RefreshOverviewsTest.php index 820b3712..45b32143 100644 --- a/tests/Feature/Console/RefreshOverviewsTest.php +++ b/tests/Feature/Console/RefreshOverviewsTest.php @@ -48,6 +48,10 @@ public function test_valid_generation_of_overviews(): void 'name' => 'Ninjanaut', ]); + $alphaZombies = Gamevariant::factory()->createOne([ + 'name' => 'Alpha Zombies', + ]); + $map1 = Map::factory()->createOne([ 'name' => 'Absolute', 'level_id' => $level->id, @@ -107,6 +111,11 @@ public function test_valid_generation_of_overviews(): void 'gamevariant_id' => $ninjaNaut->id, ]); + Game::factory()->createOne([ + 'map_id' => $map1->id, + 'gamevariant_id' => $alphaZombies->id, + ]); + // Act $this->artisan('analytics:overviews:refresh') ->expectsOutputToContain('Processed '.$game->map->name)