Initial commit

This commit is contained in:
Zdeněk Burda
2026-01-09 21:26:40 +01:00
parent e83aec6dca
commit 41e3ce6f25
404 changed files with 61250 additions and 28 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Tests\Feature\Auth;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class LoginControllerTest extends TestCase
{
use RefreshDatabase;
public function test_login_success_returns_user(): void
{
$user = $this->createUser([
'password' => 'demodemo',
]);
$response = $this->withSession([])->postJson('/api/login', [
'email' => $user->email,
'password' => 'demodemo',
]);
$response->assertStatus(200)
->assertJsonFragment([
'id' => $user->id,
'email' => $user->email,
]);
}
public function test_login_inactive_user_fails(): void
{
$user = $this->createInactiveUser([
'password' => 'demodemo',
]);
$response = $this->withSession([])->postJson('/api/login', [
'email' => $user->email,
'password' => 'demodemo',
]);
$response->assertStatus(422);
}
}