Implements Spec 114 System Console Control Tower pages, widgets, triage actions, directory views, and enterprise polish (badges, repair workspace owners table, health indicator).
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\PlatformUser;
|
|
use App\Models\Tenant;
|
|
use App\Models\Workspace;
|
|
use App\Support\Auth\PlatformCapabilities;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('forbids workspaces directory when platform.directory.view is missing', function () {
|
|
$platformUser = PlatformUser::factory()->create([
|
|
'capabilities' => [
|
|
PlatformCapabilities::ACCESS_SYSTEM_PANEL,
|
|
],
|
|
'is_active' => true,
|
|
]);
|
|
|
|
$this->actingAs($platformUser, 'platform')
|
|
->get('/system/directory/workspaces')
|
|
->assertForbidden();
|
|
});
|
|
|
|
it('lists workspaces in the system directory', function () {
|
|
$workspaceA = Workspace::factory()->create(['name' => 'Alpha Workspace']);
|
|
$workspaceB = Workspace::factory()->create(['name' => 'Bravo Workspace']);
|
|
|
|
Tenant::factory()->create([
|
|
'workspace_id' => (int) $workspaceA->getKey(),
|
|
'name' => 'Tenant A',
|
|
]);
|
|
|
|
Tenant::factory()->create([
|
|
'workspace_id' => (int) $workspaceB->getKey(),
|
|
'name' => 'Tenant B',
|
|
]);
|
|
|
|
$platformUser = PlatformUser::factory()->create([
|
|
'capabilities' => [
|
|
PlatformCapabilities::ACCESS_SYSTEM_PANEL,
|
|
PlatformCapabilities::DIRECTORY_VIEW,
|
|
],
|
|
'is_active' => true,
|
|
]);
|
|
|
|
$this->actingAs($platformUser, 'platform')
|
|
->get('/system/directory/workspaces')
|
|
->assertSuccessful()
|
|
->assertSee('Alpha Workspace')
|
|
->assertSee('Bravo Workspace');
|
|
});
|