eZ\Publish\Core\Repository\Tests\Service\Mock\SearchTest::testFindLocationsWithDefaultQueryValues PHP Method

testFindLocationsWithDefaultQueryValues() public method

Test for the findContent() method.
    public function testFindLocationsWithDefaultQueryValues()
    {
        $repositoryMock = $this->getRepositoryMock();
        /** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */
        $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler');
        $domainMapperMock = $this->getDomainMapperMock();
        $service = new SearchService($repositoryMock, $searchHandlerMock, $domainMapperMock, $this->getPermissionsCriterionHandlerMock(), array());
        $spiLocation = new SPILocation();
        $locationMock = $this->getMockForAbstractClass('eZ\\Publish\\API\\Repository\\Values\\Content\\Location');
        $domainMapperMock->expects($this->once())->method('buildLocationDomainObject')->with($this->equalTo($spiLocation))->will($this->returnValue($locationMock));
        /* @var \PHPUnit_Framework_MockObject_MockObject $searchHandlerMock */
        $searchHandlerMock->expects($this->once())->method('findLocations')->with(new LocationQuery(array('filter' => new Criterion\MatchAll(), 'limit' => 25)))->will($this->returnValue(new SearchResult(array('searchHits' => array(new SearchHit(array('valueObject' => $spiLocation))), 'totalCount' => 1))));
        $result = $service->findLocations(new LocationQuery(), array(), false);
        $this->assertEquals(new SearchResult(array('searchHits' => array(new SearchHit(array('valueObject' => $locationMock))), 'totalCount' => 1)), $result);
    }