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

testFindContentWithDefaultQueryValues() public method

Test for the findContent() method.
    public function testFindContentWithDefaultQueryValues()
    {
        $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());
        $repositoryMock->expects($this->once())->method('getContentService')->will($this->returnValue($contentServiceMock = $this->getMockBuilder('eZ\\Publish\\Core\\Repository\\ContentService')->disableOriginalConstructor()->getMock()));
        $languageFilter = array();
        $spiContentInfo = new SPIContentInfo();
        $contentMock = $this->getMockForAbstractClass('eZ\\Publish\\API\\Repository\\Values\\Content\\Content');
        $domainMapperMock->expects($this->never())->method($this->anything());
        $contentServiceMock->expects($this->once())->method('internalLoadContent')->will($this->returnValue($contentMock));
        /* @var \PHPUnit_Framework_MockObject_MockObject $searchHandlerMock */
        $searchHandlerMock->expects($this->once())->method('findContent')->with(new Query(array('filter' => new Criterion\MatchAll(), 'limit' => 25)), array())->will($this->returnValue(new SearchResult(array('searchHits' => array(new SearchHit(array('valueObject' => $spiContentInfo))), 'totalCount' => 1))));
        $result = $service->findContent(new Query(), $languageFilter, false);
        $this->assertEquals(new SearchResult(array('searchHits' => array(new SearchHit(array('valueObject' => $contentMock))), 'totalCount' => 1)), $result);
    }