stepanek
Trying to Test Password Change Functionality
it('can reset a password ', function () {
Notification::fake();
$user = User::factory()->create();
$token = app(PasswordBroker::class)->createToken($user);
$url = Filament::getResetPasswordUrl($token, $user);
$user->notify(new ResetPasswordNotification($token));
Notification::assertSentTo($user, ResetPasswordNotification::class);
$this->get($url)->assertOk();
$password = 'password&TEST123!';
livewire(ResetPassword::class, [
'token' => $token,
'email' => $user->email,
])
->assertSuccessful()
->set('password', $password)
->set('passwordConfirmation', $password)
->call('resetPassword');
$this->assertTrue(Hash::check($password, $user->fresh()->password));
});
Hey i experienced the same problem and managed to fix it by loading the token and email into the ResetPassword component.
livewire(ResetPassword::class, [ 'token' => $token, 'email' => $user->email, ])...
3 replies