byos_laravel/tests/Feature/Auth/PasswordConfirmationTest.php
Benjamin Nussbaum 94f5cabcff
feat: update to Laravel 12 starter kit (#1)
fix: path of ScreenGeneratorCommand
2025-02-25 12:15:35 +01:00

40 lines
No EOL
998 B
PHP

<?php
use App\Models\User;
use Livewire\Volt\Volt;
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
test('confirm password screen can be rendered', function () {
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/confirm-password');
$response->assertStatus(200);
});
test('password can be confirmed', function () {
$user = User::factory()->create();
$this->actingAs($user);
$response = Volt::test('auth.confirm-password')
->set('password', 'password')
->call('confirmPassword');
$response
->assertHasNoErrors()
->assertRedirect(route('dashboard', absolute: false));
});
test('password is not confirmed with invalid password', function () {
$user = User::factory()->create();
$this->actingAs($user);
$response = Volt::test('auth.confirm-password')
->set('password', 'wrong-password')
->call('confirmPassword');
$response->assertHasErrors(['password']);
});