Skip to content

Commit bc782a7

Browse files
author
Miguel Angel
committed
test: fix logout method in AuthTest RedirectTest and SecurityLoggerTest
1 parent bc707eb commit bc782a7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tests/Feature/AuthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testAuthLoginAndLogout()
2121
$user = User::factory()->create();
2222
Auth::login($user);
2323
$this->assertEquals($user->id, Auth::id());
24-
Auth::logout();
24+
Auth::logoutCurrentDevice();
2525
$this->assertNull(Auth::user());
2626
}
2727

tests/Feature/RedirectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function test401RedirectsToLogin()
2727
$response = $this->get('/requests');
2828
$response->assertStatus(200);
2929
$response->assertViewIs('requests.index');
30-
Auth::logout();
30+
Auth::logoutCurrentDevice();
3131
$response = $this->get('/requests');
3232
//302 because we want to make sure they are being redirected
3333
$response->assertStatus(302);

tests/Feature/SecurityLoggerTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public function testLogSecurityEvents()
4343
$this->assertDatabaseHas('security_logs', ['event' => 'login', 'user_id' => $user->id]);
4444

4545
// Attempt to logout
46-
Auth::logout();
46+
if (in_array(Auth::getDefaultDriver(), config('samlidp.guards'))) {
47+
return redirect('saml/logout');
48+
} else {
49+
Auth::logout();
50+
}
4751
$this->assertDatabaseHas('security_logs', ['event' => 'logout', 'user_id' => $user->id]);
4852

4953
// Disable security logging

0 commit comments

Comments
 (0)