Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Classes/Domain/Site/SiteHashService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use Doctrine\DBAL\Driver\Exception as DBALDriverException;
use Throwable;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -77,20 +78,19 @@ public function getSiteHashForDomain(string $domain): string
}

/**
* Returns a comma separated list of all domains from all sites.
* Returns a comma separated list with domains of all sites.
*
* @return string
* @throws DBALDriverException
* @throws Throwable
*/
protected function getDomainListOfAllSites(): string
{
$sites = $this->getAvailableSites();
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
$sites = $siteFinder->getAllSites();
$domains = [];
foreach ($sites as $site) {
$domains[] = $site->getDomain();
$domains[] = $site->getBase()->getHost();
}

return implode(',', $domains);
}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Unit/Domain/Site/SiteHashServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public function canResolveSiteHashAllowedSites($allowedSitesConfiguration, $expe
$siteB = $this->getDumbMock(Site::class);
$siteB->expects(self::any())->method('getDomain')->willReturn('solrtestb.local');
$allSites = [$siteA, $siteB];
$allSitesString = ('solrtesta.local,solrtestb.local');

/** @var $siteHashServiceMock SiteHashService */
$siteHashServiceMock = $this->getMockBuilder(SiteHashService::class)->onlyMethods(['getAvailableSites', 'getSiteByPageId'])->getMock();
$siteHashServiceMock = $this->getMockBuilder(SiteHashService::class)->onlyMethods(['getDomainListOfAllSites', 'getAvailableSites', 'getSiteByPageId'])->getMock();
$siteHashServiceMock->expects(self::any())->method('getDomainListOfAllSites')->willReturn($allSitesString);
$siteHashServiceMock->expects(self::any())->method('getAvailableSites')->willReturn($allSites);
$siteHashServiceMock->expects(self::any())->method('getSiteByPageId')->willReturn($siteA);

Expand Down