Files
monica/tests/Feature/Auth/PasswordConfirmationTest.php
T
2024-04-07 22:37:54 +02:00

51 lines
1.2 KiB
PHP

<?php
namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class PasswordConfirmationTest extends TestCase
{
use DatabaseTransactions;
#[Test]
public function confirm_password_screen_can_be_rendered()
{
$this->withoutVite();
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/user/confirm-password');
$response->assertStatus(200);
}
#[Test]
public function password_can_be_confirmed()
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/user/confirm-password', [
'password' => 'password',
]);
$response->assertRedirect();
$response->assertSessionHasNoErrors();
}
#[Test]
public function password_is_not_confirmed_with_invalid_password()
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/user/confirm-password', [
'password' => 'wrong-password',
]);
$response->assertSessionHasErrors();
}
}