- Update OperateHub scope label copy (All tenants / Filtered by tenant) - Fix Alerts KPI tenant resolution via activeEntitledTenant() - Remove tenant indicator from manage lists - Improve AlertRule form labels + sections - UI polish: resource sections + tenant view widget layout + RBAC progressive disclosure - Add/adjust Pest coverage
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function (): void {
|
|
Http::preventStrayRequests();
|
|
});
|
|
|
|
it('does not set or clear tenant context on GET /admin/operations', function (): void {
|
|
$tenant = Tenant::factory()->create();
|
|
[$user, $tenant] = createUserWithTenant($tenant, role: 'owner');
|
|
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get('/admin/operations')
|
|
->assertOk();
|
|
|
|
expect(Filament::getTenant())->toBe($tenant);
|
|
});
|
|
|
|
it('renders workspace scope label when no tenant context is active', function (): void {
|
|
$tenant = Tenant::factory()->create();
|
|
[$user, $tenant] = createUserWithTenant($tenant, role: 'owner');
|
|
|
|
Filament::setTenant(null, true);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get('/admin/operations')
|
|
->assertOk()
|
|
->assertSee('All tenants');
|
|
|
|
expect(Filament::getTenant())->toBeNull();
|
|
});
|