create(); $response = $this->actingAs($user)->get(route('user.index')); $response->assertStatus(200); } public function test_guest_can_not_view_profile() { $response = $this->get(route('user.index')); $response->assertRedirect(route('auth.login')); } public function test_user_can_update() { $user = User::factory()->create(); $response = $this->actingAs($user) ->post(route('user.update'), [ 'current_password' => 'password', 'password' => 'newpassword', 'password_confirmation' => 'newpassword' ]); $response->assertRedirect(route('user.index')); } public function test_guest_can_not_update() { $response = $this->post(route('user.update'), [ 'current_password' => 'password', 'password' => 'newpassword', 'password_confirmation' => 'newpassword' ]); $response->assertRedirect(route('auth.login')); } }