PasswordConfirmationTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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()
  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()
  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()
  25. {
  26. $user = User::factory()->create();
  27. $response = $this->actingAs($user)->post('/confirm-password', [
  28. 'password' => 'wrong-password',
  29. ]);
  30. $response->assertSessionHasErrors();
  31. }
  32. }