withoutMiddleware(PreventRequestForgery::class); } public function test_user_can_register(): void { Role::create(['name' => 'client', 'guard_name' => 'web']); $response = $this->post('/register', [ 'name' => 'Test Client', 'email' => 'client@example.test', 'password' => 'password12345', 'password_confirmation' => 'password12345', ]); $response->assertRedirect('/dashboard'); $this->assertAuthenticated(); $this->assertDatabaseHas('users', ['email' => 'client@example.test']); } public function test_user_can_login_and_logout(): void { $user = User::factory()->create(['password' => 'password12345']); $this->post('/login', ['email' => $user->email, 'password' => 'password12345']) ->assertRedirect('/dashboard'); $this->assertAuthenticatedAs($user); $this->post('/logout')->assertRedirect('/'); $this->assertGuest(); } }