Some checks are pending
Main Confidence / confidence (push) Waiting to run
## Summary - add a shared provider target-scope descriptor, normalizer, identity-context metadata, and surface-summary layer - update provider connection list, detail, create, edit, and onboarding surfaces to use neutral target-scope vocabulary while keeping Microsoft identity contextual - align provider connection audit and resolver output with the neutral target-scope contract and add focused guard/unit/feature coverage for regressions ## Validation - browser smoke: opened the tenant-scoped provider connection list, drilled into detail, and verified the edit/create surfaces in local admin context ## Notes - this PR comes from the session branch created for the active feature work - no additional runtime or persistence layer was introduced in this slice Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #274
86 lines
3.8 KiB
PHP
86 lines
3.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\ProviderConnectionResource;
|
|
use App\Filament\Resources\ProviderConnectionResource\Pages\ListProviderConnections;
|
|
use App\Models\ProviderConnection;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Support\Facades\Bus;
|
|
use Livewire\Livewire;
|
|
|
|
it('renders Provider Connections DB-only (no outbound HTTP, no background work)', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$connection = ProviderConnection::factory()->create([
|
|
'tenant_id' => $tenant->getKey(),
|
|
'display_name' => 'Contoso',
|
|
'entra_tenant_id' => fake()->uuid(),
|
|
'provider' => 'microsoft',
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
Bus::fake();
|
|
|
|
assertNoOutboundHttp(function () use ($tenant, $connection): void {
|
|
$this->get(ProviderConnectionResource::getUrl('index', tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee('Contoso');
|
|
|
|
$this->get(ProviderConnectionResource::getUrl('edit', ['record' => $connection], tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee('Contoso');
|
|
});
|
|
|
|
Bus::assertNothingDispatched();
|
|
});
|
|
|
|
it('keeps provider connection table defaults calm and persists state without outbound HTTP', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner', ensureDefaultMicrosoftProviderConnection: false);
|
|
|
|
$this->actingAs($user);
|
|
$tenant->makeCurrent();
|
|
Filament::setTenant($tenant, true);
|
|
|
|
assertNoOutboundHttp(function () use ($user): void {
|
|
$component = Livewire::actingAs($user)
|
|
->test(ListProviderConnections::class)
|
|
->assertTableEmptyStateActionsExistInOrder(['create'])
|
|
->searchTable('Contoso')
|
|
->call('sortTable', 'display_name', 'desc')
|
|
->set('tableFilters.default_only.isActive', true);
|
|
|
|
$table = $component->instance()->getTable();
|
|
$visibleColumnNames = collect($table->getVisibleColumns())
|
|
->map(fn ($column): string => $column->getName())
|
|
->values()
|
|
->all();
|
|
|
|
expect($table->getPaginationPageOptions())->toBe(\App\Support\Filament\TablePaginationProfiles::resource());
|
|
expect($table->getEmptyStateHeading())->toBe('No provider connections found');
|
|
expect($table->getColumn('display_name')?->isSearchable())->toBeTrue();
|
|
expect($table->getColumn('display_name')?->isSortable())->toBeTrue();
|
|
expect($visibleColumnNames)->toContain('provider', 'target_scope', 'is_enabled', 'consent_status', 'verification_status');
|
|
expect($visibleColumnNames)->not->toContain('status');
|
|
expect($visibleColumnNames)->not->toContain('health_status');
|
|
expect($visibleColumnNames)->not->toContain('entra_tenant_id');
|
|
expect($table->getColumn('status'))->toBeNull();
|
|
expect($table->getColumn('health_status'))->toBeNull();
|
|
expect($table->getColumn('provider')?->isToggledHiddenByDefault())->toBeFalse();
|
|
expect($table->getColumn('target_scope')?->getLabel())->toBe('Target scope');
|
|
expect($table->getColumn('entra_tenant_id')?->getLabel())->toBe('Microsoft tenant ID');
|
|
expect($table->getColumn('entra_tenant_id')?->isToggledHiddenByDefault())->toBeTrue();
|
|
expect($table->getColumn('migration_review_required'))->not->toBeNull();
|
|
expect(count($table->getVisibleColumns()))->toBeLessThanOrEqual(8);
|
|
expect(session()->get($component->instance()->getTableSearchSessionKey()))->toBe('Contoso');
|
|
expect(session()->get($component->instance()->getTableSortSessionKey()))->toBe('display_name:desc');
|
|
|
|
Livewire::actingAs($user)
|
|
->test(ListProviderConnections::class)
|
|
->assertSet('tableSearch', 'Contoso')
|
|
->assertSet('tableSort', 'display_name:desc')
|
|
->assertSet('tableFilters.default_only.isActive', true);
|
|
});
|
|
});
|