- Update API: events, users, policies, routes, resources, migrations - Remove deprecated models/resources (customers, setlists, invitations, etc.) - Refresh admin app and docs; remove apps/band Made-with: Cursor
34 lines
724 B
PHP
34 lines
724 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Auth;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Laravel\Sanctum\Sanctum;
|
|
use Tests\TestCase;
|
|
|
|
class LogoutTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_authenticated_user_can_logout(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
Sanctum::actingAs($user);
|
|
|
|
$response = $this->postJson('/api/v1/auth/logout');
|
|
|
|
$response->assertOk()
|
|
->assertJson(['success' => true]);
|
|
}
|
|
|
|
public function test_unauthenticated_user_cannot_logout(): void
|
|
{
|
|
$response = $this->postJson('/api/v1/auth/logout');
|
|
|
|
$response->assertUnauthorized();
|
|
}
|
|
}
|