makeCrossTenantCompareFixture(); $this->createPortfolioCompareSubject( tenant: $fixture['sourceTenant'], displayName: 'WiFi Corp', snapshot: ['settings' => [['key' => 'wifi', 'value' => 1]]], ); $this->createPortfolioCompareSubject( tenant: $fixture['targetTenant'], displayName: 'WiFi Corp', snapshot: ['settings' => [['key' => 'wifi', 'value' => 1]]], ); $this->createPortfolioCompareSubject( tenant: $fixture['sourceTenant'], displayName: 'Windows Compliance', snapshot: ['settings' => [['key' => 'compliance', 'value' => 1]]], ); $this->createPortfolioCompareSubject( tenant: $fixture['targetTenant'], displayName: 'Windows Compliance', snapshot: ['settings' => [['key' => 'compliance', 'value' => 2]]], ); $session = $this->setAdminWorkspaceContext($fixture['user'], $fixture['workspace']); $query = [ 'source_tenant_id' => (int) $fixture['sourceTenant']->getKey(), 'target_tenant_id' => (int) $fixture['targetTenant']->getKey(), 'policy_type' => ['deviceConfiguration'], ]; $this->withSession($session) ->get(CrossTenantComparePage::getUrl(parameters: $query, panel: 'admin')) ->assertOk() ->assertSee('Cross-tenant compare') ->assertSee('Compare preview') ->assertSee('WiFi Corp') ->assertSee('Windows Compliance') ->assertSee('Source tenant: '.$fixture['sourceTenant']->name) ->assertSee('Target tenant: '.$fixture['targetTenant']->name) ->assertSee(TenantResource::getUrl('view', ['record' => $fixture['sourceTenant']], panel: 'admin'), false) ->assertSee(TenantResource::getUrl('view', ['record' => $fixture['targetTenant']], panel: 'admin'), false); Livewire::withQueryParams($query) ->actingAs($fixture['user']) ->test(CrossTenantComparePage::class) ->assertActionVisible('generatePromotionPreflight') ->assertActionEnabled('generatePromotionPreflight') ->call('generatePromotionPreflight') ->assertHasNoErrors() ->assertSee('Promotion preflight') ->assertSee('WiFi Corp') ->assertSee('Windows Compliance'); }); it('rejects the same tenant as source and target without rendering compare results', function (): void { $fixture = $this->makeCrossTenantCompareFixture(); $session = $this->setAdminWorkspaceContext($fixture['user'], $fixture['workspace']); $this->withSession($session) ->get(CrossTenantComparePage::getUrl(parameters: [ 'source_tenant_id' => (int) $fixture['sourceTenant']->getKey(), 'target_tenant_id' => (int) $fixture['sourceTenant']->getKey(), ], panel: 'admin')) ->assertOk() ->assertSee('Choose two different tenants.') ->assertDontSee('data-testid="cross-tenant-compare-preview"', false) ->assertDontSee('Promotion preflight'); });