public function testGenerateWithContentId() { $locationId = 123; $contentId = 456; $location = new Location(array('id' => $locationId)); $contentInfo = new ContentInfo(array('id' => $contentId, 'mainLocationId' => $locationId)); $parameters = array('some' => 'thing'); $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH; $generatedLink = '/foo/bar'; $this->contentService->expects($this->once())->method('loadContentInfo')->with($contentId)->will($this->returnValue($contentInfo)); $this->locationService->expects($this->once())->method('loadLocation')->with($contentInfo->mainLocationId)->will($this->returnValue($location)); $this->urlALiasGenerator->expects($this->once())->method('generate')->with($location, $parameters, $referenceType)->will($this->returnValue($generatedLink)); $this->assertSame($generatedLink, $this->router->generate(UrlAliasRouter::URL_ALIAS_ROUTE_NAME, $parameters + array('contentId' => $contentId), $referenceType)); }