protected mockPublishUrlAliasesForContent ( eZ\Publish\API\Repository\Values\Content\Content $content ) | ||
$content | eZ\Publish\API\Repository\Values\Content\Content |
protected function mockPublishUrlAliasesForContent(APIContent $content)
{
$nameSchemaServiceMock = $this->getNameSchemaServiceMock();
/** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
$urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
$locationServiceMock = $this->getLocationServiceMock();
$location = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Location');
$location->expects($this->at(0))->method('__get')->with('id')->will($this->returnValue(123));
$location->expects($this->at(1))->method('__get')->with('parentLocationId')->will($this->returnValue(456));
$urlAliasNames = array('eng-GB' => 'hello');
$nameSchemaServiceMock->expects($this->once())->method('resolveUrlAliasSchema')->with($content)->will($this->returnValue($urlAliasNames));
$locationServiceMock->expects($this->once())->method('loadLocations')->with($content->getVersionInfo()->getContentInfo())->will($this->returnValue(array($location)));
$urlAliasHandlerMock->expects($this->once())->method('publishUrlAliasForLocation')->with(123, 456, 'hello', 'eng-GB', true, true);
}