Create tests for app/actions/fortify/UpdateUserPassword
This commit is contained in:
parent
373ad8b869
commit
328aa110e2
|
|
@ -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();
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue