protected function getContentMapperMock() { $mapperMock = $this->getMock('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Mapper', array('extractContentInfoFromRows'), array($this->fieldRegistry, $this->getLanguageHandler())); $mapperMock->expects($this->any())->method('extractContentInfoFromRows')->with($this->isType('array'))->will($this->returnCallback(function ($rows) { $contentInfoObjs = array(); foreach ($rows as $row) { $contentId = (int) $row['id']; if (!isset($contentInfoObjs[$contentId])) { $contentInfoObjs[$contentId] = new ContentInfo(); $contentInfoObjs[$contentId]->id = $contentId; } } return array_values($contentInfoObjs); })); return $mapperMock; }