vito/tests/Feature/Http/Auth/PasswordConfirmationTest.php
Saeed Vaziry 9030427f78
Two factor (#47)
* init 2fa

* fix code style
2023-09-11 20:47:44 +02:00

48 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Http\Auth;
use Illuminate\Foundation\Testing\RefreshDatabase;
use JsonException;
use Tests\TestCase;
class PasswordConfirmationTest extends TestCase
{
use RefreshDatabase;
public function test_confirm_password_screen_can_be_rendered(): void
{
$this->actingAs($this->user);
$response = $this->get(route('password.confirm'));
$response->assertStatus(200);
}
/**
* @throws JsonException
*/
public function test_password_can_be_confirmed(): void
{
$this->actingAs($this->user);
$response = $this->post(route('password.confirm'), [
'password' => 'password',
]);
$response->assertRedirect();
$response->assertSessionHasNoErrors();
}
public function test_password_is_not_confirmed_with_invalid_password(): void
{
$this->actingAs($this->user);
$response = $this->post(route('password.confirm'), [
'password' => 'wrong-password',
]);
$response->assertSessionHasErrors();
}
}