Skip to content

Commit

Permalink
update UserRecentlyPlayedGamesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
luchaos committed Oct 31, 2023
1 parent 6b82276 commit ac9b274
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/Feature/Api/V1/UserRecentlyPlayedGamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ public function testGetUserRecentlyPlayedGames(): void
/** @var User $user */
$user = User::factory()->create();

$now = Carbon::now();

$hardcoreAchievement = $publishedAchievements->get(0);
$this->addHardcoreUnlock($user, $hardcoreAchievement, $now);
$this->addHardcoreUnlock($user, $hardcoreAchievement, Carbon::now()->subDays(1));
$softcoreAchievement = $publishedAchievements->get(1);
$this->addSoftcoreUnlock($user, $softcoreAchievement, $now);
$this->addSoftcoreUnlock($user, $softcoreAchievement, Carbon::now()->subDays(1));

$playerGame = $user->playerGame($game);

// addHardcoreUnlock will create a player_game for game. need to manually create one for game2
$playerGame2 = new PlayerGame([
'user_id' => $user->ID,
'game_id' => $game2->ID,
'created_at' => $now,
'last_played_at' => $now,
'created_at' => Carbon::now()->subHours(1),
'last_played_at' => Carbon::now()->subMinutes(5),
]);
$playerGame2->save();

Expand All @@ -80,7 +80,7 @@ public function testGetUserRecentlyPlayedGames(): void
'ConsoleID' => $system->ID,
'ConsoleName' => $system->Name,
'ImageIcon' => $game2->ImageIcon,
'LastPlayed' => $now,
'LastPlayed' => $playerGame2->last_played_at->__toString(),
'NumPossibleAchievements' => 0,
'PossibleScore' => 0,
'NumAchieved' => 0,
Expand All @@ -94,7 +94,7 @@ public function testGetUserRecentlyPlayedGames(): void
'ConsoleID' => $system->ID,
'ConsoleName' => $system->Name,
'ImageIcon' => $game->ImageIcon,
'LastPlayed' => $now,
'LastPlayed' => $playerGame->last_played_at->__toString(),
'NumPossibleAchievements' => 3,
'PossibleScore' => $publishedAchievements->get(0)->Points +
$publishedAchievements->get(1)->Points +
Expand Down

0 comments on commit ac9b274

Please sign in to comment.