Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
test('password update page is displayed', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this
|
|
->actingAs($user)
|
|
->get(route('user-password.edit'));
|
|
|
|
$response->assertOk();
|
|
});
|
|
|
|
test('password can be updated', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this
|
|
->actingAs($user)
|
|
->from(route('user-password.edit'))
|
|
->put(route('user-password.update'), [
|
|
'current_password' => 'password',
|
|
'password' => 'new-password',
|
|
'password_confirmation' => 'new-password',
|
|
]);
|
|
|
|
$response
|
|
->assertSessionHasNoErrors()
|
|
->assertRedirect(route('user-password.edit'));
|
|
|
|
expect(Hash::check('new-password', $user->refresh()->password))->toBeTrue();
|
|
});
|
|
|
|
test('correct password must be provided to update password', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this
|
|
->actingAs($user)
|
|
->from(route('user-password.edit'))
|
|
->put(route('user-password.update'), [
|
|
'current_password' => 'wrong-password',
|
|
'password' => 'new-password',
|
|
'password_confirmation' => 'new-password',
|
|
]);
|
|
|
|
$response
|
|
->assertSessionHasErrors('current_password')
|
|
->assertRedirect(route('user-password.edit'));
|
|
}); |