Aplikasi Keuangan yang mengatur lalu lintas transaksi antara bank dan aplikasi internal Kampus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

25 lines
758 B

<?php
use App\Domains\Identity\Actions\Passwords\UpdatePassword;
use App\Domains\Identity\DTOs\Passwords\UpdatePasswordDTO;
use App\Domains\Identity\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
uses(Tests\TestCase::class, RefreshDatabase::class);
test('it can update user password', function () {
$user = User::factory()->create([
'password' => 'old_password',
]);
$dto = new UpdatePasswordDTO(
new_password: 'new_password',
);
$action = new UpdatePassword();
$action->execute($user, $dto);
expect(Hash::check('new_password', $user->fresh()->password))->toBeTrue()
->and(Hash::check('old_password', $user->fresh()->password))->toBeFalse();
});