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