eZ\Publish\Core\Search\Legacy\Tests\Content\Location\HandlerLocationTest::getLocationMapperMock PHP Method

getLocationMapperMock() protected method

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