From dc6b946bb4b0d79e5ec1fece7e141d5543dda49a Mon Sep 17 00:00:00 2001 From: Benni Mack Date: Fri, 2 Jun 2023 10:30:44 +0200 Subject: [PATCH] [!!!][TASK] Remove UriStrategy logic and move to PSR-14 event The UriStrategy concept was needed to generate Frontend URLs in order to index a frontend page. This concept was used in TYPO3 v9 to support site-based routing and non-site-based projects. This has now been removed as TYPO3 Core v11+ does only support site-based frontend page resolving. For this reason, the "UriStrategyFactory" and all the handling has been removed, and the "TYPO3SiteStrategy" has been renamed to "PageUriBuilder". The hook logic to modify the indexing URL `$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier']` and the according interface "PageIndexerDataUrlModifier" has been removed and replaced by a new PSR-14 event: `ApacheSolrForTypo3\Solr\Event\Indexing\AfterFrontendPageUriForIndexingHasBeenGeneratedEvent". Usages of UriHelper have been reduced in favor of PSR-7 UriInterface. IntegrationTests for the new Event have been added. --- .../Helper/UriBuilder/AbstractUriStrategy.php | 133 ----------------- .../Helper/UriBuilder/TYPO3SiteStrategy.php | 67 --------- .../PageIndexer/Helper/UriStrategyFactory.php | 50 ------- .../Index/PageIndexer/PageUriBuilder.php | 137 ++++++++++++++++++ ...ageUriForIndexingHasBeenGeneratedEvent.php | 69 +++++++++ Classes/IndexQueue/PageIndexer.php | 23 +-- .../Index/PageIndexer/PageUriBuilderTest.php | 54 +++++++ .../TestPageUriModification.php | 35 +++++ .../Configuration/Services.yaml | 5 + ...trategyTest.php => PageUriBuilderTest.php} | 28 ++-- Tests/Unit/IndexQueue/PageIndexerTest.php | 12 +- 11 files changed, 334 insertions(+), 279 deletions(-) delete mode 100644 Classes/Domain/Index/PageIndexer/Helper/UriBuilder/AbstractUriStrategy.php delete mode 100644 Classes/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategy.php delete mode 100644 Classes/Domain/Index/PageIndexer/Helper/UriStrategyFactory.php create mode 100644 Classes/Domain/Index/PageIndexer/PageUriBuilder.php create mode 100644 Classes/Event/Indexing/AfterFrontendPageUriForIndexingHasBeenGeneratedEvent.php create mode 100644 Tests/Integration/Domain/Index/PageIndexer/PageUriBuilderTest.php create mode 100644 Tests/Integration/Fixtures/Extensions/fake_extension3/Classes/EventListeners/TestPageUriModification.php rename Tests/Unit/Domain/Index/PageIndexer/{Helper/UriBuilder/TYPO3SiteStrategyTest.php => PageUriBuilderTest.php} (69%) diff --git a/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/AbstractUriStrategy.php b/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/AbstractUriStrategy.php deleted file mode 100644 index a39e8d3d17..0000000000 --- a/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/AbstractUriStrategy.php +++ /dev/null @@ -1,133 +0,0 @@ -logger = $logger ?? GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__); - } - - protected function applyTypoScriptOverridesOnIndexingUrl(UrlHelper $urlHelper, array $overrideConfiguration = []): UrlHelper - { - // check whether we should use ssl / https - if (!empty($overrideConfiguration['scheme'])) { - $urlHelper = $urlHelper->withScheme($overrideConfiguration['scheme']); - } - - // overwriting the host - if (!empty($overrideConfiguration['host'])) { - $urlHelper = $urlHelper->withHost($overrideConfiguration['host']); - } - - // overwriting the port - if (!empty($overrideConfiguration['port'])) { - $urlHelper = $urlHelper->withPort((int)$overrideConfiguration['port']); - } - - // setting a path if TYPO3 is installed in a subdirectory - if (!empty($overrideConfiguration['path'])) { - $urlHelper = $urlHelper->withPath($overrideConfiguration['path']); - } - - return $urlHelper; - } - - public function getPageIndexingUriFromPageItemAndLanguageId( - Item $item, - int $language = 0, - string $mountPointParameter = '', - array $options = [] - ): string { - $pageIndexUri = $this->buildPageIndexingUriFromPageItemAndLanguageId($item, $language, $mountPointParameter); - $urlHelper = GeneralUtility::makeInstance(UrlHelper::class, $pageIndexUri); - $overrideConfiguration = $options['frontendDataHelper.'] ?? []; - $urlHelper = $this->applyTypoScriptOverridesOnIndexingUrl($urlHelper, $overrideConfiguration); - $dataUrl = (string)$urlHelper; - - if (!GeneralUtility::isValidUrl($dataUrl)) { - $this->logger->log( - SolrLogManager::ERROR, - 'Could not create a valid URL to get frontend data while trying to index a page.', - [ - 'item' => (array)$item, - 'constructed URL' => $dataUrl, - 'scheme' => $urlHelper->getScheme(), - 'host' => $urlHelper->getHost(), - 'path' => $urlHelper->getPath(), - 'page ID' => $item->getRecordUid(), - 'indexer options' => $options, - ] - ); - - throw new RuntimeException( - 'Could not create a valid URL to get frontend data while trying to index a page. Created URL: ' . $dataUrl, - 1311080805 - ); - } - - return $this->applyDataUrlModifier($item, $language, $dataUrl, $urlHelper); - } - - abstract protected function buildPageIndexingUriFromPageItemAndLanguageId( - Item $item, - int $language = 0, - string $mountPointParameter = '' - ); - - protected function applyDataUrlModifier( - Item $item, - int $language, - string $dataUrl, - UrlHelper $urlHelper - ): string { - if (empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier'])) { - return $dataUrl; - } - - $dataUrlModifier = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier']); - if (!$dataUrlModifier instanceof PageIndexerDataUrlModifier) { - throw new RuntimeException($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier'] . ' is not an implementation of ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerDataUrlModifier', 1290523345); - } - - return $dataUrlModifier->modifyDataUrl( - $dataUrl, - [ - 'item' => $item, 'scheme' => $urlHelper->getScheme(), 'host' => $urlHelper->getHost(), - 'path' => $urlHelper->getPath(), 'pageId' => $item->getRecordUid(), 'language' => $language, - ] - ); - } -} diff --git a/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategy.php b/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategy.php deleted file mode 100644 index 2dea26c3d8..0000000000 --- a/Classes/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategy.php +++ /dev/null @@ -1,67 +0,0 @@ -siteFinder = $siteFinder ?? GeneralUtility::makeInstance(SiteFinder::class); - } - - /** - * Builds and returns URI for page indexing from index queue item - * Handles "pages" type only. - * - * @throws SiteNotFoundException - */ - protected function buildPageIndexingUriFromPageItemAndLanguageId( - Item $item, - int $language = 0, - string $mountPointParameter = '', - ): string { - $site = $this->siteFinder->getSiteByPageId($item->getRecordUid()); - $parameters = []; - - if ($language > 0) { - $parameters['_language'] = $language; - } - - if ($mountPointParameter !== '') { - $parameters['MP'] = $mountPointParameter; - } - - return (string)$site->getRouter()->generateUri($item->getRecord(), $parameters); - } -} diff --git a/Classes/Domain/Index/PageIndexer/Helper/UriStrategyFactory.php b/Classes/Domain/Index/PageIndexer/Helper/UriStrategyFactory.php deleted file mode 100644 index d82803d896..0000000000 --- a/Classes/Domain/Index/PageIndexer/Helper/UriStrategyFactory.php +++ /dev/null @@ -1,50 +0,0 @@ -logger = $logger ?? GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__); + $this->siteFinder = $siteFinder ?? GeneralUtility::makeInstance(SiteFinder::class); + $this->eventDispatcher = $eventDispatcher ?? GeneralUtility::makeInstance(EventDispatcherInterface::class); + } + + /** + * Builds and returns URI for page indexing from index queue item + * Handles "pages" type only. + * + * @throws SiteNotFoundException + */ + protected function buildPageIndexingUriFromPageItemAndLanguageId( + Item $item, + int $language = 0, + string $mountPointParameter = '', + ): UriInterface { + $site = $this->siteFinder->getSiteByPageId($item->getRecordUid()); + $parameters = []; + + if ($language > 0) { + $parameters['_language'] = $language; + } + + if ($mountPointParameter !== '') { + $parameters['MP'] = $mountPointParameter; + } + + return $site->getRouter()->generateUri($item->getRecord(), $parameters); + } + + protected function applyTypoScriptOverridesOnIndexingUrl(UriInterface $urlHelper, array $overrideConfiguration): UriInterface + { + // check whether we should use ssl / https + if (!empty($overrideConfiguration['scheme'])) { + $urlHelper = $urlHelper->withScheme($overrideConfiguration['scheme']); + } + + // overwriting the host + if (!empty($overrideConfiguration['host'])) { + $urlHelper = $urlHelper->withHost($overrideConfiguration['host']); + } + + // overwriting the port + if (!empty($overrideConfiguration['port'])) { + $urlHelper = $urlHelper->withPort((int)$overrideConfiguration['port']); + } + + // setting a path if TYPO3 is installed in a subdirectory + if (!empty($overrideConfiguration['path'])) { + $urlHelper = $urlHelper->withPath($overrideConfiguration['path']); + } + + return $urlHelper; + } + + public function getPageIndexingUriFromPageItemAndLanguageId( + Item $item, + int $language = 0, + string $mountPointParameter = '', + array $options = [] + ): string { + $pageIndexUri = $this->buildPageIndexingUriFromPageItemAndLanguageId($item, $language, $mountPointParameter); + $overrideConfiguration = $options['frontendDataHelper.'] ?? []; + $pageIndexUri = $this->applyTypoScriptOverridesOnIndexingUrl($pageIndexUri, $overrideConfiguration); + + if (!GeneralUtility::isValidUrl((string)$pageIndexUri)) { + $this->logger->log( + SolrLogManager::ERROR, + 'Could not create a valid URL to get frontend data while trying to index a page.', + [ + 'item' => (array)$item, + 'constructed URL' => (string)$pageIndexUri, + 'scheme' => $pageIndexUri->getScheme(), + 'host' => $pageIndexUri->getHost(), + 'path' => $pageIndexUri->getPath(), + 'page ID' => $item->getRecordUid(), + 'indexer options' => $options, + ] + ); + + throw new \RuntimeException( + 'Could not create a valid URL to get frontend data while trying to index a page. Created URL: ' . (string)$pageIndexUri, + 1311080805 + ); + } + + $event = new AfterFrontendPageUriForIndexingHasBeenGeneratedEvent($item, $pageIndexUri, $language, $mountPointParameter, $options); + $event = $this->eventDispatcher->dispatch($event); + return (string)$event->getPageIndexUri(); + } +} diff --git a/Classes/Event/Indexing/AfterFrontendPageUriForIndexingHasBeenGeneratedEvent.php b/Classes/Event/Indexing/AfterFrontendPageUriForIndexingHasBeenGeneratedEvent.php new file mode 100644 index 0000000000..a692ce1b38 --- /dev/null +++ b/Classes/Event/Indexing/AfterFrontendPageUriForIndexingHasBeenGeneratedEvent.php @@ -0,0 +1,69 @@ +item; + } + + public function getPageIndexUri(): UriInterface + { + return $this->pageIndexUri; + } + + public function setPageIndexUri(UriInterface $pageIndexUri): void + { + $this->pageIndexUri = $pageIndexUri; + } + + public function getLanguageId(): int + { + return $this->languageId; + } + + public function getMountPointParameter(): string + { + return $this->mountPointParameter; + } + + public function getOptions(): array + { + return $this->options; + } +} diff --git a/Classes/IndexQueue/PageIndexer.php b/Classes/IndexQueue/PageIndexer.php index d55e6ab29b..574e31949d 100644 --- a/Classes/IndexQueue/PageIndexer.php +++ b/Classes/IndexQueue/PageIndexer.php @@ -19,14 +19,13 @@ use ApacheSolrForTypo3\Solr\Access\Rootline; use ApacheSolrForTypo3\Solr\Access\RootlineElement; -use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\AbstractUriStrategy; -use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriStrategyFactory; +use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\PageUriBuilder; use ApacheSolrForTypo3\Solr\NoSolrConnectionFoundException; use ApacheSolrForTypo3\Solr\System\Logging\SolrLogManager; use ApacheSolrForTypo3\Solr\System\Solr\SolrConnection; +use ApacheSolrForTypo3\Solr\System\Util\SiteUtility; use Doctrine\DBAL\Exception as DBALException; use Exception; -use RuntimeException; use TYPO3\CMS\Core\Type\Bitmask\PageTranslationVisibility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -235,24 +234,28 @@ protected function getPageIndexerRequest(): PageIndexerRequest * and then actually build and return the page URL. * * @throws DBALException - * @throws Exception + * @throws \Exception */ protected function getDataUrl(Item $item, int $language = 0): string { $pageId = $item->getRecordUid(); - $strategy = $this->getUriStrategy($pageId); + $uriBuilder = $this->getUriBuilder($pageId); $mountPointParameter = $this->getMountPageDataUrlParameter($item); - return $strategy->getPageIndexingUriFromPageItemAndLanguageId($item, $language, $mountPointParameter, $this->options); + return $uriBuilder->getPageIndexingUriFromPageItemAndLanguageId($item, $language, $mountPointParameter, $this->options); } /** * Returns the URI strategy object * - * @throws Exception + * @throws \Exception */ - protected function getUriStrategy(int $pageId): AbstractUriStrategy + protected function getUriBuilder(int $pageId): PageUriBuilder { - return GeneralUtility::makeInstance(UriStrategyFactory::class)->getForPageId($pageId); + if (!SiteUtility::getIsSiteManagedSite($pageId)) { + throw new \Exception('Site of page with uid ' . $pageId . ' is not a TYPO3 managed site'); + } + + return GeneralUtility::makeInstance(PageUriBuilder::class); } /** @@ -329,7 +332,7 @@ protected function indexPage(Item $item, ?int $language = 0, ?int $userGroup = 0 if (empty($indexActionResult['pageIndexed'])) { $message = 'Failed indexing page Index Queue item: ' . $item->getIndexQueueUid() . ' url: ' . $indexRequestUrl; - throw new RuntimeException($message, 1331837081); + throw new \RuntimeException($message, 1331837081); } return $response; diff --git a/Tests/Integration/Domain/Index/PageIndexer/PageUriBuilderTest.php b/Tests/Integration/Domain/Index/PageIndexer/PageUriBuilderTest.php new file mode 100644 index 0000000000..788550437c --- /dev/null +++ b/Tests/Integration/Domain/Index/PageIndexer/PageUriBuilderTest.php @@ -0,0 +1,54 @@ +writeDefaultSolrTestSiteConfiguration(); + } + + /** + * @test + */ + public function pageIndexingUriCanBeModifiedViaEventListener(): void + { + $subject = GeneralUtility::makeInstance(PageUriBuilder::class); + $item = new Item(['item_uid' => 1, 'root' => 1, 'item_type' => 'pages']); + $url = $subject->getPageIndexingUriFromPageItemAndLanguageId($item); + self::assertEquals('http://testone.site/en/', (string)$url); + $item->setIndexingProperty('size', 'enorme'); + $url = $subject->getPageIndexingUriFromPageItemAndLanguageId($item); + self::assertEquals('http://testone.site/en/?&larger=large', (string)$url); + } +} diff --git a/Tests/Integration/Fixtures/Extensions/fake_extension3/Classes/EventListeners/TestPageUriModification.php b/Tests/Integration/Fixtures/Extensions/fake_extension3/Classes/EventListeners/TestPageUriModification.php new file mode 100644 index 0000000000..d49056b466 --- /dev/null +++ b/Tests/Integration/Fixtures/Extensions/fake_extension3/Classes/EventListeners/TestPageUriModification.php @@ -0,0 +1,35 @@ +getItem()->hasIndexingProperty('size')) { + return; + } + if ($event->getItem()->getIndexingProperty('size') === 'enorme') { + $event->setPageIndexUri( + $event->getPageIndexUri()->withQuery('&larger=large') + ); + } + } +} diff --git a/Tests/Integration/Fixtures/Extensions/fake_extension3/Configuration/Services.yaml b/Tests/Integration/Fixtures/Extensions/fake_extension3/Configuration/Services.yaml index f848a6c538..2aab67721b 100644 --- a/Tests/Integration/Fixtures/Extensions/fake_extension3/Configuration/Services.yaml +++ b/Tests/Integration/Fixtures/Extensions/fake_extension3/Configuration/Services.yaml @@ -13,3 +13,8 @@ services: tags: - name: event.listener identifier: 'fake-extension3/test-modification-of-documents' + + ApacheSolrForTypo3\SolrFakeExtension3\EventListeners\TestPageUriModification: + tags: + - name: event.listener + identifier: 'fake-extension3/test-page-uri-modification' diff --git a/Tests/Unit/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategyTest.php b/Tests/Unit/Domain/Index/PageIndexer/PageUriBuilderTest.php similarity index 69% rename from Tests/Unit/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategyTest.php rename to Tests/Unit/Domain/Index/PageIndexer/PageUriBuilderTest.php index 5e61dc23d5..bb4a01f836 100644 --- a/Tests/Unit/Domain/Index/PageIndexer/Helper/UriBuilder/TYPO3SiteStrategyTest.php +++ b/Tests/Unit/Domain/Index/PageIndexer/PageUriBuilderTest.php @@ -1,18 +1,21 @@ createMock(SolrLogManager::class); - $typo3SiteStrategy = GeneralUtility::makeInstance(TYPO3SiteStrategy::class, $loggerMock, $siteFinderMock); - $typo3SiteStrategy->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo'); + $uriBuilder = GeneralUtility::makeInstance(PageUriBuilder::class, $loggerMock, $siteFinderMock, new NoopEventDispatcher()); + $uriBuilder->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo'); } /** @@ -44,8 +47,8 @@ public function canOverrideHost(): void $loggerMock = $this->createMock(SolrLogManager::class); - $typo3SiteStrategy = GeneralUtility::makeInstance(TYPO3SiteStrategy::class, $loggerMock, $siteFinderMock); - $uri = $typo3SiteStrategy->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo', ['frontendDataHelper.' => ['host' => 'www.secondsite.de']]); + $uriBuilder = GeneralUtility::makeInstance(PageUriBuilder::class, $loggerMock, $siteFinderMock, new NoopEventDispatcher()); + $uri = $uriBuilder->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo', ['frontendDataHelper.' => ['host' => 'www.secondsite.de']]); self::assertSame('http://www.secondsite.de/en/test', $uri, 'Solr site strategy generated unexpected uri'); } @@ -62,19 +65,18 @@ public function canOverrideScheme(): void $loggerMock = $this->createMock(SolrLogManager::class); - $typo3SiteStrategy = GeneralUtility::makeInstance(TYPO3SiteStrategy::class, $loggerMock, $siteFinderMock); - $uri = $typo3SiteStrategy->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo', ['frontendDataHelper.' => ['scheme' => 'https']]); + $uriBuilder = GeneralUtility::makeInstance(PageUriBuilder::class, $loggerMock, $siteFinderMock, new NoopEventDispatcher()); + $uri = $uriBuilder->getPageIndexingUriFromPageItemAndLanguageId($itemMock, 2, 'foo', ['frontendDataHelper.' => ['scheme' => 'https']]); self::assertSame('https://www.site.de/en/test', $uri, 'Solr site strategy generated unexpected uri'); } protected function getSiteFinderMock(array $pageRecord = []): SiteFinder { - $uriMock = $this->createMock(UriInterface::class); - $uriMock->expects(self::any())->method('__toString')->willReturn('http://www.site.de/en/test'); + $uri = new Uri('http://www.site.de/en/test'); $routerMock = $this->createMock(RouterInterface::class); $routerMock->expects(self::once())->method('generateUri')->with($pageRecord, ['_language' => 2, 'MP' => 'foo']) - ->willReturn($uriMock); + ->willReturn($uri); $siteMock = $this->createMock(Site::class); $siteMock->expects(self::once())->method('getRouter')->willReturn($routerMock); diff --git a/Tests/Unit/IndexQueue/PageIndexerTest.php b/Tests/Unit/IndexQueue/PageIndexerTest.php index 61b0690922..2fc38d69cb 100644 --- a/Tests/Unit/IndexQueue/PageIndexerTest.php +++ b/Tests/Unit/IndexQueue/PageIndexerTest.php @@ -17,7 +17,7 @@ use ApacheSolrForTypo3\Solr\Access\Rootline; use ApacheSolrForTypo3\Solr\ConnectionManager; -use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\AbstractUriStrategy; +use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\PageUriBuilder; use ApacheSolrForTypo3\Solr\Domain\Search\ApacheSolrDocument\Builder; use ApacheSolrForTypo3\Solr\Domain\Site\Site; use ApacheSolrForTypo3\Solr\FrontendEnvironment; @@ -39,7 +39,7 @@ class PageIndexerTest extends SetUpUnitTestCase protected SolrLogManager|MockObject $solrLogManagerMock; protected ConnectionManager|MockObject $connectionManagerMock; protected PageIndexerRequest|MockObject $pageIndexerRequestMock; - protected AbstractUriStrategy|MockObject $uriStrategyMock; + protected PageUriBuilder|MockObject $uriBuilderMock; protected MockObject|FrontendEnvironment $frontendEnvironmentMock; protected function setUp(): void @@ -49,7 +49,7 @@ protected function setUp(): void $this->solrLogManagerMock = $this->createMock(SolrLogManager::class); $this->connectionManagerMock = $this->createMock(ConnectionManager::class); $this->pageIndexerRequestMock = $this->createMock(PageIndexerRequest::class); - $this->uriStrategyMock = $this->createMock(AbstractUriStrategy::class); + $this->uriBuilderMock = $this->createMock(PageUriBuilder::class); $this->frontendEnvironmentMock = $this->createMock(FrontendEnvironment::class); parent::setUp(); } @@ -68,10 +68,10 @@ protected function getPageIndexerWithMockedDependencies(array $options = []): Pa $this->createMock(EventDispatcherInterface::class), ] ) - ->onlyMethods(['getPageIndexerRequest', 'getAccessRootlineByPageId', 'getUriStrategy']) + ->onlyMethods(['getPageIndexerRequest', 'getAccessRootlineByPageId', 'getUriBuilder']) ->getMock(); $pageIndexer->expects(self::any())->method('getPageIndexerRequest')->willReturn($this->pageIndexerRequestMock); - $pageIndexer->expects(self::any())->method('getUriStrategy')->willReturn($this->uriStrategyMock); + $pageIndexer->expects(self::any())->method('getUriBuilder')->willReturn($this->uriBuilderMock); return $pageIndexer; } @@ -90,7 +90,7 @@ public function testIndexPageItemIsSendingFrontendRequestsToExpectedUrls(): void $siteMock->expects(self::any())->method('getRootPageRecord')->willReturn(['l18n_cfg' => 0, 'title' => 'mysiteroot']); $testUri = 'http://myfrontendurl.de/index.php?id=4711&L=0'; - $this->uriStrategyMock->expects(self::any())->method('getPageIndexingUriFromPageItemAndLanguageId')->willReturn($testUri); + $this->uriBuilderMock->expects(self::any())->method('getPageIndexingUriFromPageItemAndLanguageId')->willReturn($testUri); /** @var Item|MockObject $item */ $item = $this->createMock(Item::class);