Skip to content

Commit

Permalink
Merge pull request #669 from kenjis/fix-testCheckOldToken
Browse files Browse the repository at this point in the history
test: fix failed test because of DST
  • Loading branch information
kenjis authored Mar 14, 2023
2 parents ea9688d + da1129a commit 8dca512
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ public function testCheckOldToken(): void
/** @var User $user */
$user = fake(UserModel::class);
/** @var UserIdentityModel $identities */
$identities = model(UserIdentityModel::class);
$token = $user->generateAccessToken('foo');
$token->last_used_at = Time::now()->subYears(1)->subMinutes(1);
$identities = model(UserIdentityModel::class);
$token = $user->generateAccessToken('foo');
// CI 4.2 uses the Chicago timezone that has Daylight Saving Time,
// so subtracts 1 hour to make sure this test passes.
$token->last_used_at = Time::now()->subYears(1)->subHours(1)->subMinutes(1);
$identities->save($token);

$result = $this->auth->check(['token' => $token->raw_token]);
Expand Down

0 comments on commit 8dca512

Please sign in to comment.