## 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
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Models\InventoryItem;
|
|
use App\Services\Baselines\CurrentStateHashResolver;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
it('Baseline resolver remains batch-oriented (bounded query count)', function () {
|
|
[, $tenant] = createUserWithTenant();
|
|
|
|
$inventoryItems = InventoryItem::factory()
|
|
->count(500)
|
|
->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'policy_type' => 'deviceConfiguration',
|
|
'meta_jsonb' => [
|
|
'odata_type' => '#microsoft.graph.deviceConfiguration',
|
|
'etag' => 'E',
|
|
'scope_tag_ids' => [],
|
|
'assignment_target_count' => 1,
|
|
],
|
|
'last_seen_operation_run_id' => null,
|
|
'last_seen_at' => now(),
|
|
]);
|
|
|
|
$subjects = $inventoryItems->map(static fn (InventoryItem $item): array => [
|
|
'policy_type' => (string) $item->policy_type,
|
|
'subject_external_id' => (string) $item->external_id,
|
|
])->all();
|
|
|
|
DB::enableQueryLog();
|
|
DB::flushQueryLog();
|
|
|
|
app(CurrentStateHashResolver::class)->resolveForSubjects(
|
|
tenant: $tenant,
|
|
subjects: $subjects,
|
|
since: null,
|
|
latestInventorySyncRunId: null,
|
|
);
|
|
|
|
$queryCount = count(DB::getQueryLog());
|
|
|
|
expect($queryCount)->toBeLessThanOrEqual(20);
|
|
});
|