TenantAtlas/apps/platform/tests/Feature/078/KpiHeaderTenantlessTest.php
Ahmed Darrazi 9873095f31
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 6m23s
feat: productize operations hub decision-first workbench
2026-05-19 02:48:39 +02:00

39 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\OperationRun;
use App\Support\Workspaces\WorkspaceContext;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
final class KpiHeaderTenantlessTest extends TestCase
{
use RefreshDatabase;
public function test_shows_workspace_operations_kpi_stats_when_environment_shell_context_is_absent(): void
{
[$user, $tenant] = createUserWithTenant(role: 'owner');
OperationRun::factory()->count(3)->create([
'workspace_id' => (int) $tenant->workspace_id,
'managed_environment_id' => (int) $tenant->getKey(),
]);
Filament::setTenant(null, true);
$this->actingAs($user)
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get(\App\Support\OperationRunLinks::index())
->assertOk()
->assertSee('Needs attention')
->assertSee('Active operations')
->assertSee('Failed or blocked')
->assertSee('Completed recently')
->assertDontSee('Total Operations (30 days)')
->assertDontSee('Failed/Partial (7 days)')
->assertDontSee('Avg Duration (7 days)');
}
}