## Summary - replace the legacy Tenant and TenantMembership core models with ManagedEnvironment and ManagedEnvironmentMembership - propagate the managed environment naming and key changes across Filament resources, pages, controllers, jobs, models, and supporting runtime paths - add feature 279 spec artifacts and focused managed-environment test coverage for model behavior, route binding, panel context, authorization, and legacy guardrails ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentAuthorizationTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentPanelContextTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentRouteBindingTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentContextResolverTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentModelTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Notes - branch pushed from commit `1123b122` - browser smoke test file was added but not run in this pass Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #335
53 lines
2.1 KiB
PHP
53 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Services\OperationRunService;
|
|
use App\Support\OperationRunOutcome;
|
|
use App\Support\OperationRunStatus;
|
|
use App\Support\Providers\ProviderReasonCodes;
|
|
|
|
it('Spec081 stores blocked operation runs with sanitized reason and link-only next steps', function (): void {
|
|
$tenant = ManagedEnvironment::factory()->create();
|
|
$service = app(OperationRunService::class);
|
|
|
|
$run = $service->ensureRunWithIdentity(
|
|
tenant: $tenant,
|
|
type: 'provider.connection.check',
|
|
identityInputs: [
|
|
'provider_connection_id' => 99,
|
|
],
|
|
context: [
|
|
'provider' => 'microsoft',
|
|
'provider_connection_id' => 99,
|
|
'target_scope' => [
|
|
'entra_tenant_id' => $tenant->graphTenantId(),
|
|
],
|
|
],
|
|
);
|
|
|
|
$finalized = $service->finalizeBlockedRun(
|
|
run: $run,
|
|
reasonCode: ProviderReasonCodes::ProviderCredentialMissing,
|
|
nextSteps: [
|
|
['label' => 'Update Credentials', 'url' => '/admin/tenants/demo/provider-connections'],
|
|
['label' => '', 'url' => '/invalid'],
|
|
],
|
|
message: 'client_secret=super-secret',
|
|
);
|
|
|
|
$finalized->refresh();
|
|
|
|
expect($finalized->status)->toBe(OperationRunStatus::Completed->value)
|
|
->and($finalized->outcome)->toBe(OperationRunOutcome::Blocked->value)
|
|
->and($finalized->context['reason_code'] ?? null)->toBe(ProviderReasonCodes::ProviderCredentialMissing)
|
|
->and(data_get($finalized->context, 'reason_translation.operator_label'))->toBe('Credentials missing')
|
|
->and(data_get($finalized->context, 'reason_translation.short_explanation'))->toContain('credentials required to authenticate')
|
|
->and($finalized->context['next_steps'] ?? [])->toBe([
|
|
['label' => 'Update Credentials', 'url' => '/admin/tenants/demo/provider-connections'],
|
|
])
|
|
->and($finalized->failure_summary[0]['reason_code'] ?? null)->toBe(ProviderReasonCodes::ProviderCredentialMissing)
|
|
->and((string) ($finalized->failure_summary[0]['message'] ?? ''))->not->toContain('secret');
|
|
});
|