Installed Laravel

This commit is contained in:
2025-09-13 22:32:19 +10:00
parent 9ef6cd69b7
commit 5ad54abff2
269 changed files with 25065 additions and 27 deletions

View File

@@ -0,0 +1,52 @@
<?php
use App\Models\User;
use Illuminate\Support\Facades\Hash;
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
test('password update page is displayed', function () {
$user = User::factory()->create();
$response = $this
->actingAs($user)
->get(route('password.edit'));
$response->assertStatus(200);
});
test('password can be updated', function () {
$user = User::factory()->create();
$response = $this
->actingAs($user)
->from(route('password.edit'))
->put(route('password.update'), [
'current_password' => 'password',
'password' => 'new-password',
'password_confirmation' => 'new-password',
]);
$response
->assertSessionHasNoErrors()
->assertRedirect(route('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('password.edit'))
->put(route('password.update'), [
'current_password' => 'wrong-password',
'password' => 'new-password',
'password_confirmation' => 'new-password',
]);
$response
->assertSessionHasErrors('current_password')
->assertRedirect(route('password.edit'));
});