Files
ppeasy_vg12/tests/Feature/Api/Auth/Password/RemindControllerTest.php
T
2026-10-09 08:21:06 +02:00

28 lines
744 B
PHP

<?php
use App\Mail\ResetPassword;
use App\Models\User;
test('test send password reminder', function () {
$this->setSettings(['forgot_password' => true]);
Mail::fake();
$user = User::factory()->create(['email' => 'test@test.com']);
$this->postJson('api/password/remind', ['email' => 'test@test.com'])
->assertOk();
Mail::assertQueued(ResetPassword::class, function ($mail) use ($user) {
return $mail->hasTo($user->email);
});
});
test('test password reminder with wrong email', function () {
$this->setSettings(['forgot_password' => true]);
$this->postJson('api/password/remind', ['email' => 'test@test.com'])
->assertStatus(422)
->assertJsonValidationErrors('email');
});