instance(); if ($instance->getCachedHeaderActions() === []) { $instance->cacheInteractsWithHeaderActions(); } return $instance->getCachedHeaderActions(); } function editTenantHeaderGroupLabels(Testable $component): array { return collect(editTenantHeaderActions($component)) ->filter(static fn ($action): bool => $action instanceof ActionGroup && $action->isVisible()) ->map(static fn (ActionGroup $action): string => (string) $action->getLabel()) ->values() ->all(); } function editTenantHeaderPrimaryNames(Testable $component): array { return collect(editTenantHeaderActions($component)) ->reject(static fn ($action): bool => $action instanceof ActionGroup) ->filter(static fn ($action): bool => ! method_exists($action, 'isVisible') || $action->isVisible()) ->map(static fn ($action): ?string => $action instanceof Action ? $action->getName() : null) ->filter() ->values() ->all(); } it('keeps related links in contextual placement and reserves the header for lifecycle actions', function (): void { $tenant = Tenant::factory()->onboarding()->create(); [$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner', ensureDefaultMicrosoftProviderConnection: false); createOnboardingDraft([ 'workspace' => $tenant->workspace, 'tenant' => $tenant, 'started_by' => $user, 'updated_by' => $user, 'state' => [ 'entra_tenant_id' => (string) $tenant->tenant_id, 'tenant_name' => (string) $tenant->name, ], ]); $this->actingAs($user); Filament::setTenant($tenant, true); $component = Livewire::test(EditTenant::class, ['record' => $tenant->getRouteKey()]) ->assertSee('Related context') ->assertSee('Open tenant detail') ->assertSee('Resume onboarding'); expect(editTenantHeaderPrimaryNames($component))->toBe([]) ->and(editTenantHeaderGroupLabels($component))->toBe([]); }); it('keeps tenant lifecycle mutations available under the lifecycle header group with confirmation intact', function (): void { $tenant = Tenant::factory()->active()->create(); [$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner'); $this->actingAs($user); Filament::setTenant($tenant, true); $component = Livewire::test(EditTenant::class, ['record' => $tenant->getRouteKey()]) ->assertActionVisible('archive') ->assertActionEnabled('archive') ->assertActionExists('archive', fn (Action $action): bool => $action->isConfirmationRequired()); expect(editTenantHeaderPrimaryNames($component))->toBe([]) ->and(editTenantHeaderGroupLabels($component))->toBe(['Lifecycle']); });