You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. <?php
  2. namespace Tests\Feature\Auth;
  3. use App\Models\User;
  4. use Illuminate\Foundation\Testing\RefreshDatabase;
  5. use Tests\TestCase;
  6. class PasswordConfirmationTest extends TestCase
  7. {
  8. use RefreshDatabase;
  9. public function test_confirm_password_screen_can_be_rendered(): void
  10. {
  11. $user = User::factory()->create();
  12. $response = $this->actingAs($user)->get('/confirm-password');
  13. $response->assertStatus(200);
  14. }
  15. public function test_password_can_be_confirmed(): void
  16. {
  17. $user = User::factory()->create();
  18. $response = $this->actingAs($user)->post('/confirm-password', [
  19. 'password' => 'password',
  20. ]);
  21. $response->assertRedirect();
  22. $response->assertSessionHasNoErrors();
  23. }
  24. public function test_password_is_not_confirmed_with_invalid_password(): void
  25. {
  26. $user = User::factory()->create();
  27. $response = $this->actingAs($user)->post('/confirm-password', [
  28. 'password' => 'wrong-password',
  29. ]);
  30. $response->assertSessionHasErrors();
  31. }
  32. }