auditionadmin/tests/Feature/app/Actions/Fortify/UpdateUserPasswordTest.php

24 lines
659 B
PHP

<?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();
});