create(); $tenantB = Tenant::factory()->create(); /** @var InventoryItem $itemA */ $itemA = InventoryItem::factory()->create([ 'tenant_id' => $tenantA->getKey(), 'external_id' => (string) Str::uuid(), ]); // Edge for tenant A InventoryLink::factory()->create([ 'tenant_id' => $tenantA->getKey(), 'source_type' => 'inventory_item', 'source_id' => $itemA->external_id, 'target_type' => 'foundation_object', 'target_id' => (string) Str::uuid(), 'relationship_type' => 'assigned_to', ]); // Edge for tenant B with same source/target ids but different tenant InventoryLink::factory()->create([ 'tenant_id' => $tenantB->getKey(), 'source_type' => 'inventory_item', 'source_id' => $itemA->external_id, 'target_type' => 'foundation_object', 'target_id' => (string) Str::uuid(), 'relationship_type' => 'assigned_to', ]); $svc = app(DependencyQueryService::class); $outboundA = $svc->getOutboundEdges($itemA); expect($outboundA->count())->toBe(1); });