admin()->create([ 'email' => 'registered@example.com', ]); Livewire::test(RequestPasswordReset::class) ->set('data.email', $user->email) ->call('request') ->assertNotified($this->expectedSentNotification()); MailNotification::assertSentTo($user, ResetPassword::class); } public function test_reset_request_for_unknown_email_reports_the_same_success_response(): void { MailNotification::fake(); Livewire::test(RequestPasswordReset::class) ->set('data.email', 'nobody@example.com') ->call('request') ->assertNotified($this->expectedSentNotification()); MailNotification::assertNothingSent(); } public function test_repeated_reset_requests_for_a_registered_email_keep_reporting_success(): void { MailNotification::fake(); $user = User::factory()->admin()->create([ 'email' => 'registered-repeat@example.com', ]); $page = Livewire::test(RequestPasswordReset::class); // First request creates a reset token; the second, within Laravel's // default 60s broker throttle, would surface Password::RESET_THROTTLED // instead of Password::RESET_LINK_SENT without the override above. // The email field is re-set before each call because a successful // `request()` resets the form (see the base page's `$this->form->fill()`). $page->set('data.email', $user->email) ->call('request') ->assertNotified($this->expectedSentNotification()); $page->set('data.email', $user->email) ->call('request') ->assertNotified($this->expectedSentNotification()); } private function expectedSentNotification(): FilamentNotification { return FilamentNotification::make() ->title(__(Password::RESET_LINK_SENT)) ->body(__('filament-panels::auth/pages/password-reset/request-password-reset.notifications.sent.body')) ->success(); } }