diff --git a/stubs/api/pest-tests/Feature/Auth/AuthenticationTest.php b/stubs/api/pest-tests/Feature/Auth/AuthenticationTest.php index 2bdcca135..316a4f4b8 100644 --- a/stubs/api/pest-tests/Feature/Auth/AuthenticationTest.php +++ b/stubs/api/pest-tests/Feature/Auth/AuthenticationTest.php @@ -24,3 +24,12 @@ $this->assertGuest(); }); + +test('users can logout', function () { + $user = User::factory()->create(); + + $response = $this->actingAs($user)->post('/logout'); + + $this->assertGuest(); + $response->assertNoContent(); +}); diff --git a/stubs/api/tests/Feature/Auth/AuthenticationTest.php b/stubs/api/tests/Feature/Auth/AuthenticationTest.php index 9042cafa2..223655166 100644 --- a/stubs/api/tests/Feature/Auth/AuthenticationTest.php +++ b/stubs/api/tests/Feature/Auth/AuthenticationTest.php @@ -34,4 +34,14 @@ public function test_users_can_not_authenticate_with_invalid_password(): void $this->assertGuest(); } + + public function test_users_can_logout(): void + { + $user = User::factory()->create(); + + $response = $this->actingAs($user)->post('/logout'); + + $this->assertGuest(); + $response->assertNoContent(); + } } diff --git a/stubs/default/pest-tests/Feature/Auth/AuthenticationTest.php b/stubs/default/pest-tests/Feature/Auth/AuthenticationTest.php index a19f60e3e..45c9c808c 100644 --- a/stubs/default/pest-tests/Feature/Auth/AuthenticationTest.php +++ b/stubs/default/pest-tests/Feature/Auth/AuthenticationTest.php @@ -31,3 +31,12 @@ $this->assertGuest(); }); + +test('users can logout', function () { + $user = User::factory()->create(); + + $response = $this->actingAs($user)->post('/logout'); + + $this->assertGuest(); + $response->assertRedirect('/'); +}); diff --git a/stubs/default/tests/Feature/Auth/AuthenticationTest.php b/stubs/default/tests/Feature/Auth/AuthenticationTest.php index 2d0eeed6a..0303b2908 100644 --- a/stubs/default/tests/Feature/Auth/AuthenticationTest.php +++ b/stubs/default/tests/Feature/Auth/AuthenticationTest.php @@ -42,4 +42,14 @@ public function test_users_can_not_authenticate_with_invalid_password(): void $this->assertGuest(); } + + public function test_users_can_logout(): void + { + $user = User::factory()->create(); + + $response = $this->actingAs($user)->post('/logout'); + + $this->assertGuest(); + $response->assertRedirect('/'); + } }