public function onSiteAccessMatch(PostSiteAccessMatchEvent $event) { $rootLocationId = $this->configResolver->getParameter('content.tree_root.location_id'); $this->urlAliasRouter->setRootLocationId($rootLocationId); $this->urlAliasGenerator->setRootLocationId($rootLocationId); $this->urlAliasGenerator->setExcludedUriPrefixes($this->configResolver->getParameter('content.tree_root.excluded_uri_prefixes')); }
/** * @dataProvider generateProvider */ public function testGenerateWithSiteAccessNoReverseMatch($urlResource, array $parameters, $referenceType) { $matcher = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\SiteAccess\\URILexer'); $this->generator->setSiteAccess(new SiteAccess('test', 'test', $matcher)); $baseUrl = '/base/url'; $requestContext = new RequestContext($baseUrl); $this->generator->setRequestContext($requestContext); $uri = '/some/thing'; $this->generator->expects($this->once())->method('doGenerate')->with($urlResource, $parameters)->will($this->returnValue($uri)); $fullUri = $baseUrl . $uri; $matcher->expects($this->once())->method('analyseLink')->with($uri)->will($this->returnValue($uri)); if ($referenceType === UrlGeneratorInterface::ABSOLUTE_URL) { $fullUri = $requestContext->getScheme() . '://' . $requestContext->getHost() . $baseUrl . $uri; } $siteAccessName = 'fake'; $this->siteAccessRouter->expects($this->once())->method('matchByName')->with($siteAccessName)->will($this->returnValue(null)); $this->logger->expects($this->once())->method('notice'); $this->assertSame($fullUri, $this->generator->generate($urlResource, $parameters + array('siteaccess' => $siteAccessName), $referenceType)); }