protected function getLocationMapperMock()
{
$mapperMock = $this->getMock('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Mapper', array('createLocationsFromRows'));
$mapperMock->expects($this->any())->method('createLocationsFromRows')->with($this->isType('array'))->will($this->returnCallback(function ($rows) {
$locations = array();
foreach ($rows as $row) {
$locationId = (int) $row['node_id'];
if (!isset($locations[$locationId])) {
$locations[$locationId] = new SPILocation();
$locations[$locationId]->id = $locationId;
}
}
return array_values($locations);
}));
return $mapperMock;
}