eZ\Publish\Core\Search\Legacy\Tests\Content\HandlerContentTest::getContentMapperMock PHP Method

getContentMapperMock() protected method

Returns a content mapper mock.
protected getContentMapperMock ( ) : Mapper
return eZ\Publish\Core\Persistence\Legacy\Content\Mapper
    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;
    }
HandlerContentTest