count(500) ->create([ 'tenant_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); });