I've been trying to test if my user gets logged out after 120 minutes, but I've not been able to do this. Currently, my function that logs in my user is like this:
public function loginUser(LoginUserRequest $request)
{
$response = $this->auth_service->login($request->all());
return $response;
}
I've tried using Laravel's time travel to check if after two hours the user isn't logged anymore, but this simply doesn't work as I expected. Anyone knows what to do in this case?
public function a_user_is_logged_out_after_two_hours()
{
$password = $this->faker->password(6, 12);
$user = User::factory()->withEncryptedPassword($password)->create();
$credentials = ['usu_email' => $user->usu_email, 'usu_password' => $password];
$this->post(route('cms.auth.log_user'), $credentials);
$this->travel(121)->minutes();
$this->assertEquals(null, auth()->user());
}