Creating a test for password reset email – getting error (mailable not queued) when running test
I am using the auth that came with Laravel. I am testing the page where you put in your email and when you hit the submit button a password reset email will be sent to your email. The password reset email is sent when I do it manually. But I created this test to make sure the password reset email is sent but it's not working.
I am getting this error:
There was 1 failure: 1) The expected [IlluminateFoundationAuthResetPassword] mailable was not queued. Failed asserting that false is true.
I am using this code as a guide:
https://github.com/JeffreyWay/council/blob/master/tests/Feature/Auth/RegisterUserTest.php
<?php
namespace TestsControllersUnit; use TestsTestCase; use IlluminateSupportFacadesMail; use IlluminateAuthNotificationsResetPassword; use IlluminateFoundationTestingRefreshDatabase; class ResetPasswordEmailTest extends TestCase { use RefreshDatabase; public function setUp() { parent::setUp(); Mail::fake(); } /** @test */ public function does_send_password_reset_email() { $user = factory('AppUser')->create(); $this->post(route('password.email'), ['email' => $user->email]) Mail::assertQueued(ResetPassword::class); } }
submitted by /u/dipshake99
[link] [comments]
from Laravel Questions and Answers https://laravelquestions.com/rlaravel/creating-a-test-for-password-reset-email-getting-error-mailable-not-queued-when-running-test/
via Lzo Media
No comments:
Post a Comment