create(['must_change_password' => false]); $this->actingAs($user)->get('/')->assertOk(); } public function test_user_that_must_change_password_is_still_redirected(): void { $user = User::factory()->create(['must_change_password' => true]); $this->actingAs($user)->get('/')->assertRedirect(route('password.change')); } public function test_password_change_lands_on_dashboard_not_2fa_setup(): void { $user = User::factory()->create(['must_change_password' => true, 'password' => bcrypt('old-Password-1')]); Livewire::actingAs($user)->test(PasswordChange::class) ->set('current', 'old-Password-1') ->set('password', 'new-Password-123') ->set('password_confirmation', 'new-Password-123') ->call('update') ->assertRedirect(route('dashboard')); } public function test_broadcast_gate_passes_on_password_rotation_alone(): void { $user = User::factory()->create(['must_change_password' => false]); $this->assertTrue($user->securityOnboarded()); } }