Initial commit

This commit is contained in:
2026-02-03 10:38:46 +01:00
commit eb304f4b14
144 changed files with 22605 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use App\Models\User;
use Illuminate\Support\Facades\Hash;
test('login fails with invalid credentials', function () {
$response = test()->postJson('/api/auth/login', [
'email' => 'wrong@example.com',
'password' => 'wrong',
]);
$response->assertStatus(422);
});
test('login succeeds with valid credentials', function () {
User::factory()->create([
'email' => 'admin@test.com',
'password' => Hash::make('secret'),
]);
$response = test()->postJson('/api/auth/login', [
'email' => 'admin@test.com',
'password' => 'secret',
]);
$response->assertOk();
$response->assertJsonPath('user.email', 'admin@test.com');
});
test('auth user returns 401 when unauthenticated', function () {
$response = test()->getJson('/api/auth/user');
$response->assertStatus(401);
});