Skip to content

Commit

Permalink
Account lockout policy - unit test rely on config to avoid issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rochamarcelo committed Mar 29, 2024
1 parent f83bf92 commit ef0a2df
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ public function testIsUnlockedSaveLockoutAndCompleted()
$handler = new LockoutHandler([
'numberOfAttemptsFail' => 7,
]);
$expiredTimeout = $handler->getConfig('lockoutTimeInSeconds') + 10;
$this->assertGreaterThan(10, $expiredTimeout);
$UsersTable = TableRegistry::getTableLocator()->get('Users');
$userId = '00000000-0000-0000-0000-000000000004';
$UsersTable->updateAll(['lockout_time' => new DateTime('-6 minutes')], ['id' => $userId]);
$UsersTable->updateAll(['lockout_time' => new DateTime('-' . $expiredTimeout . 'minutes')], ['id' => $userId]);
$userBefore = $UsersTable->get($userId);
$this->assertInstanceOf(DateTime::class, $userBefore->lockout_time);

Expand Down

0 comments on commit ef0a2df

Please sign in to comment.