massive improvements to tests, streamlined and synced migrations, fixed a lot of wrong or old table field references. implemented a lot of pages in react for website frontend

This commit is contained in:
Codex Agent
2025-09-30 21:09:52 +02:00
parent 21c9391e2c
commit d1733686a6
114 changed files with 2867 additions and 2411 deletions

View File

@@ -5,6 +5,7 @@ namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
class AuthenticationTest extends TestCase
{
@@ -22,7 +23,20 @@ class AuthenticationTest extends TestCase
$user = User::factory()->create();
$response = $this->post(route('login.store'), [
'email' => $user->email,
'login' => $user->email,
'password' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
}
public function test_users_can_authenticate_with_username()
{
$user = User::factory()->create(['username' => 'testuser']);
$response = $this->post(route('login.store'), [
'login' => 'testuser',
'password' => 'password',
]);
@@ -34,12 +48,29 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$this->post(route('login.store'), [
'email' => $user->email,
$response = $this->post(route('login.store'), [
'login' => $user->email,
'password' => 'wrong-password',
]);
$this->assertGuest();
$response->assertRedirect(route('login', absolute: false));
$response->assertSessionHasErrors(['login' => 'Diese Anmeldedaten wurden nicht gefunden.']);
}
public function test_login_redirects_unverified_user_to_verification_notice()
{
$user = User::factory()->create([
'email_verified_at' => null,
]);
$response = $this->post(route('login.store'), [
'login' => $user->email,
'password' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(route('verification.notice', absolute: false));
}
public function test_users_can_logout()
@@ -49,7 +80,7 @@ class AuthenticationTest extends TestCase
$response = $this->actingAs($user)->post(route('logout'));
$this->assertGuest();
$response->assertRedirect(route('home'));
$response->assertRedirect('/');
}
public function test_users_are_rate_limited()
@@ -57,23 +88,20 @@ class AuthenticationTest extends TestCase
$user = User::factory()->create();
for ($i = 0; $i < 5; $i++) {
$this->post(route('login.store'), [
'email' => $user->email,
$response = $this->post(route('login.store'), [
'login' => $user->email,
'password' => 'wrong-password',
])->assertStatus(302)->assertSessionHasErrors([
'email' => 'These credentials do not match our records.',
]);
$response->assertStatus(302);
$response->assertSessionHasErrors(['login' => 'Diese Anmeldedaten wurden nicht gefunden.']);
}
$response = $this->post(route('login.store'), [
'email' => $user->email,
'login' => $user->email,
'password' => 'wrong-password',
]);
$response->assertSessionHasErrors('email');
$errors = session('errors');
$this->assertStringContainsString('Too many login attempts', $errors->first('email'));
$response->assertStatus(302);
$response->assertSessionHasErrors(['login' => 'Zu viele Login-Versuche. Bitte versuche es in :seconds Sekunden erneut.']);
}
}