feat: add user authentication with livewire components

This commit is contained in:
jeremy bayse
2026-06-24 06:53:19 +02:00
parent 5b05dfa8c7
commit fa38396479
9 changed files with 368 additions and 11 deletions
+15 -2
View File
@@ -2,18 +2,31 @@
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\Models\User;
use Tests\TestCase;
class ExampleTest extends TestCase
{
use RefreshDatabase;
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
public function test_the_application_redirects_unauthenticated_users(): void
{
$response = $this->get('/');
$response->assertStatus(302);
$response->assertRedirect('/login');
}
public function test_authenticated_users_can_access_the_dashboard(): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/');
$response->assertStatus(200);
}
}