create(['role' => 'user']); $response = $this->actingAs($user)->get('/dashboard'); $response->assertRedirect('/packages'); } public function test_user_role_cannot_access_event_admin_dashboard(): void { $user = User::factory()->create(['role' => 'user']); $response = $this->actingAs($user)->get('/event-admin/dashboard'); $response->assertRedirect('/packages'); } public function test_user_role_cannot_access_event_admin_logout(): void { $user = User::factory()->create(['role' => 'user']); $response = $this->actingAs($user)->get('/event-admin/logout'); $response->assertRedirect('/packages'); } public function test_user_role_login_redirects_to_packages(): void { $user = User::factory()->create(['email' => 'test@example.com', 'role' => 'user']); $response = $this->post('/login', [ 'login' => 'test@example.com', 'password' => 'password', ]); $response->assertRedirect('/packages'); } public function test_tenant_admin_can_access_both_dashboards(): void { $user = User::factory()->create(['role' => 'tenant_admin']); // Can access regular dashboard $response1 = $this->actingAs($user)->get('/dashboard'); $response1->assertStatus(200); // Can access event admin dashboard $response2 = $this->actingAs($user)->get('/event-admin/dashboard'); $response2->assertStatus(200); } public function test_super_admin_can_access_both_dashboards(): void { $user = User::factory()->create(['role' => 'super_admin']); // Can access regular dashboard $response1 = $this->actingAs($user)->get('/dashboard'); $response1->assertStatus(200); // Can access event admin dashboard $response2 = $this->actingAs($user)->get('/event-admin/dashboard'); $response2->assertStatus(200); } public function test_super_admin_can_access_super_admin_docs_panel(): void { $user = User::factory()->create(['role' => 'super_admin']); $response = $this->actingAs($user, 'super_admin')->get('/super-admin/docs'); $response->assertRedirect(); $redirectPath = parse_url((string) $response->headers->get('Location'), PHP_URL_PATH); $this->assertNotSame('/super-admin/docs/login', $redirectPath); $this->assertStringStartsWith('/super-admin/docs', (string) $redirectPath); } public function test_non_super_admin_cannot_access_super_admin_docs_panel(): void { $user = User::factory()->create(['role' => 'tenant_admin']); $response = $this->actingAs($user, 'super_admin')->get('/super-admin/docs'); $response->assertForbidden(); } }