public function testConvertContentLink($input, $output, $contentId, $urlResolved) { $locationId = 106; $inputDocument = new DOMDocument(); $inputDocument->loadXML($input); $contentService = $this->getMockContentService(); $locationService = $this->getMockLocationService(); $urlAliasRouter = $this->getMockUrlAliasRouter(); $contentInfo = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo'); $location = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Location'); $contentInfo->expects($this->once())->method('__get')->with($this->equalTo('mainLocationId'))->will($this->returnValue($locationId)); $contentService->expects($this->any())->method('loadContentInfo')->with($this->equalTo($contentId))->will($this->returnValue($contentInfo)); $locationService->expects($this->once())->method('loadLocation')->with($this->equalTo($locationId))->will($this->returnValue($location)); $urlAliasRouter->expects($this->once())->method('generate')->with($this->equalTo($location))->will($this->returnValue($urlResolved)); $converter = new Link($locationService, $contentService, $urlAliasRouter); $outputDocument = $converter->convert($inputDocument); $expectedOutputDocument = new DOMDocument(); $expectedOutputDocument->loadXML($output); $this->assertEquals($expectedOutputDocument, $outputDocument); }