get(route('password.request'))->assertSeeLivewire(PasswordReset::class)->assertDontSee('Dashboard'); }); it('shows intro', function () { Livewire::test(PasswordReset::class)->assertSee('Hier kannst du dein Passwort zurücksetzen.'); }); it('it needs email address', function (string $email, string $error) { Livewire::test(PasswordReset::class) ->set('email', $email) ->call('submit') ->assertHasErrors(['email' => $error]); }) ->with([ ['', 'E-Mail Adresse ist erforderlich.'], ['aaa', 'E-Mail Adresse muss eine gültige E-Mail-Adresse sein.'], ]); it('displays error when user doesnt exsst', function () { Livewire::test(PasswordReset::class) ->set('email', 'nowhere@example.com') ->call('submit') ->assertHasErrors(['email' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.']); }); it('requests link', function () { Notification::fake(); $user = User::factory()->loginData('admin@example.com', 'secret')->create(); Livewire::test(PasswordReset::class) ->set('email', 'admin@example.com') ->call('submit') ->assertDispatched('success', 'Du hast weitere Instruktionen per E-Mail erhalten.'); Notification::assertSentTo($user, ResetPassword::class); });