## Summary - implement the provider capability registry and derived capability evaluation flow - update provider connections, onboarding, required-permissions diagnostics, and provider blocker translation to use capability-first summaries - add bounded unit, feature, and browser test coverage plus the prepared Spec 283 artifacts ## Notes - branch: `283-provider-capability-registry` - commit: `74e75c3e` - no additional validation commands were run in this git/PR flow step Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #342
39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\ProviderConnection;
|
|
use App\Support\Providers\ProviderReasonCodes;
|
|
use App\Support\Providers\ProviderReasonTranslator;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('translates provider permission blockers with capability-first operator copy', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner', ensureDefaultMicrosoftProviderConnection: false);
|
|
|
|
$connection = ProviderConnection::factory()->consentGranted()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'entra_tenant_id' => (string) $tenant->managed_environment_id,
|
|
'provider' => 'microsoft',
|
|
]);
|
|
|
|
$envelope = app(ProviderReasonTranslator::class)->translate(
|
|
ProviderReasonCodes::ProviderPermissionMissing,
|
|
context: [
|
|
'tenant' => $tenant,
|
|
'connection' => $connection,
|
|
'provider_capability' => [
|
|
'provider_capability_key' => 'directory_groups_read',
|
|
'label' => 'Directory groups read',
|
|
'status' => 'missing',
|
|
],
|
|
],
|
|
);
|
|
|
|
expect($envelope?->operatorLabel)->toBe('Directory groups read capability missing')
|
|
->and($envelope?->shortExplanation)->toContain('Directory groups read capability')
|
|
->and($envelope?->firstNextStep()?->label)->toBe('Open Required Permissions');
|
|
});
|