user = User::factory()->create(); }); it('resets a user password', function () { $changer = app(ResetUserPassword::class); $changer->reset($this->user, ['password' => 'password123', 'password_confirmation' => 'password123']); $this->user->refresh(); expect(\Illuminate\Support\Facades\Hash::check('password123', $this->user->password))->toBeTrue(); }); it('logs password change', function () { $changer = app(ResetUserPassword::class); $changer->reset($this->user, ['password' => 'password123', 'password_confirmation' => 'password123']); $logEntry = \App\Models\AuditLogEntry::first(); expect($logEntry->message)->toEqual('Changed password for '.$this->user->email.' ('.$this->user->full_name().')'); });