Files
fotospiel-app/tests/Feature/Auth/TenantAdminEntryTest.php

43 lines
1019 B
PHP

<?php
namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class TenantAdminEntryTest extends TestCase
{
use RefreshDatabase;
public function test_guest_is_redirected_to_admin_start(): void
{
$response = $this->get('/event-admin/dashboard');
$response->assertRedirect('/event-admin/start');
}
public function test_tenant_admin_can_access_admin_shell(): void
{
$user = User::factory()->create([
'role' => 'tenant_admin',
]);
$response = $this->actingAs($user)->get('/event-admin/dashboard');
$response->assertOk();
$response->assertViewIs('admin');
}
public function test_regular_user_is_redirected_to_packages(): void
{
$user = User::factory()->create([
'role' => 'user',
]);
$response = $this->actingAs($user)->get('/event-admin/dashboard');
$response->assertRedirect('/packages');
}
}