TenantAtlas/apps/platform/tests/Unit/Support/OperationalControls/OperationalControlScopeResolutionTest.php
ahmido be314c577f Spec 400: rebuild Tenantial homepage visuals (#387)
## Summary
- rebuild the public Tenantial homepage around an evidence-first Microsoft tenant governance narrative
- replace the old hero visual with a new static dashboard preview and add dedicated Trust Bar and Feature Pillars sections
- update the shared public shell, navigation, footer, dark design tokens, assets, and homepage content to match the new brand direction
- align website smoke coverage and Spec 400 artifacts with the rebuilt homepage

## Testing
- not run in this pass
- updated website smoke specs under apps/website/tests/smoke

## Note
- `website-dev` was pushed to `origin` so the requested PR base exists remotely
- the remote `website-dev` branch is an ancestor of `origin/dev`, so this PR may also show upstream `dev` history relative to that base

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #387
2026-05-18 14:38:11 +00:00

57 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\OperationalControlActivation;
use App\Models\Workspace;
use App\Support\OperationalControls\OperationalControlEvaluator;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('prefers an active global pause over a workspace pause', function (): void {
$workspace = Workspace::factory()->create();
OperationalControlActivation::factory()->workspaceScoped()->create([
'control_key' => 'restore.execute',
'workspace_id' => (int) $workspace->getKey(),
'reason_text' => 'Workspace pause.',
]);
$globalActivation = OperationalControlActivation::factory()->forGlobalScope()->create([
'control_key' => 'restore.execute',
'reason_text' => 'Global incident pause.',
]);
$decision = app(OperationalControlEvaluator::class)->evaluate('restore.execute', $workspace);
expect($decision->isPaused())->toBeTrue()
->and($decision->matchedScopeType)->toBe('global')
->and($decision->workspaceId)->toBeNull()
->and($decision->reasonText)->toBe('Global incident pause.')
->and($decision->sourceActivationId)->toBe((int) $globalActivation->getKey());
});
it('ignores expired global activations when resolving the effective state', function (): void {
$workspace = Workspace::factory()->create();
OperationalControlActivation::factory()->forGlobalScope()->create([
'control_key' => 'restore.execute',
'reason_text' => 'Expired global pause.',
'expires_at' => now()->subMinute(),
]);
$workspaceActivation = OperationalControlActivation::factory()->workspaceScoped()->create([
'control_key' => 'restore.execute',
'workspace_id' => (int) $workspace->getKey(),
'reason_text' => 'Active workspace pause.',
]);
$decision = app(OperationalControlEvaluator::class)->evaluate('restore.execute', $workspace);
expect($decision->isPaused())->toBeTrue()
->and($decision->matchedScopeType)->toBe('workspace')
->and($decision->workspaceId)->toBe((int) $workspace->getKey())
->and($decision->reasonText)->toBe('Active workspace pause.')
->and($decision->sourceActivationId)->toBe((int) $workspaceActivation->getKey());
});