## Summary - standardize Microsoft provider connections around explicit platform vs dedicated identity modes - centralize admin-consent URL and runtime identity resolution so platform flows no longer fall back to tenant-local credentials - add migration classification, richer consent and verification state handling, dedicated override management, and focused regression coverage ## Validation - focused repo test coverage was added across provider identity, onboarding, audit, policy, guard, and migration flows - latest explicit passing run in the workspace: `vendor/bin/sail artisan test --compact tests/Feature/AdminConsentCallbackTest.php tests/Feature/Audit/ProviderConnectionConsentAuditTest.php` ## Notes - branch includes the full Spec 137 artifact set under `specs/137-platform-provider-identity/` - target base branch: `dev` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #166
74 lines
3.0 KiB
PHP
74 lines
3.0 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();
|
|
|
|
expect($table->getPaginationPageOptions())->toBe(\App\Support\Filament\TablePaginationProfiles::resource());
|
|
expect($table->getEmptyStateHeading())->toBe('No Microsoft connections found');
|
|
expect($table->getColumn('display_name')?->isSearchable())->toBeTrue();
|
|
expect($table->getColumn('display_name')?->isSortable())->toBeTrue();
|
|
expect($table->getColumn('provider')?->isToggledHiddenByDefault())->toBeTrue();
|
|
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);
|
|
});
|
|
});
|