Create tests for app/actions/fortify/UpdateUserPassword

This commit is contained in:
Matt Young 2025-07-01 21:52:30 -05:00
parent 373ad8b869
commit 328aa110e2
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
use App\Actions\Fortify\UpdateUserPassword;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->user = User::factory()->create();
$this->changer = app(UpdateUserPassword::class);
// Log in the user
$this->actingAs($this->user);
});
it('updates a users password', function () {
$this->changer->update($this->user,
['password' => 'password123', 'password_confirmation' => 'password123', 'current_password' => 'password']);
expect(Hash::check('password123', $this->user->password))->toBeTrue();
});