updates for admin area

This commit is contained in:
Mark Gregory
2026-09-12 20:45:05 +01:00
parent 0704924aa8
commit 8c9dbfee08
50 changed files with 1337 additions and 152 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Spatie\Permission\Models\Role;
use Tests\TestCase;
class AuthenticationTest extends TestCase
{
use RefreshDatabase;
public function test_user_can_register(): void
{
Role::create(['name' => 'client', 'guard_name' => 'web']);
$response = $this->post('/register', [
'name' => 'Test Client',
'email' => 'client@example.test',
'password' => 'password12345',
'password_confirmation' => 'password12345',
]);
$response->assertRedirect('/dashboard');
$this->assertAuthenticated();
$this->assertDatabaseHas('users', ['email' => 'client@example.test']);
}
public function test_user_can_login_and_logout(): void
{
$user = User::factory()->create(['password' => 'password12345']);
$this->post('/login', ['email' => $user->email, 'password' => 'password12345'])
->assertRedirect('/dashboard');
$this->assertAuthenticatedAs($user);
$this->post('/logout')->assertRedirect('/');
$this->assertGuest();
}
}