/** * @dataProvider providerTestDoGenerateRootLocation */ public function testDoGenerateRootLocation(URLAlias $urlAlias, $isOutsideAndNotExcluded, $expected, $pathPrefix) { $excludedPrefixes = array('/products', '/shared'); $rootLocationId = 456; $this->urlAliasGenerator->setRootLocationId($rootLocationId); $this->urlAliasGenerator->setExcludedUriPrefixes($excludedPrefixes); $location = new Location(array('id' => 123)); $rootLocation = new Location(array('id' => $rootLocationId)); $rootUrlAlias = new URLAlias(array('path' => $pathPrefix)); $this->locationService->expects($this->once())->method('loadLocation')->with($rootLocationId)->will($this->returnValue($rootLocation)); $this->urlAliasService->expects($this->once())->method('reverseLookup')->with($rootLocation)->will($this->returnValue($rootUrlAlias)); $this->urlAliasService->expects($this->once())->method('listLocationAliases')->with($location, false)->will($this->returnValue(array($urlAlias))); if ($isOutsideAndNotExcluded) { $this->logger->expects($this->once())->method('warning'); } $this->assertSame($expected, $this->urlAliasGenerator->doGenerate($location, array())); }