Tests/IndexerTest.php
/**
     * @test
     * @testdox Tests if the given url is checked upon a checksum in Solr.
     */
@test
@testdox Tests if the given url is checked upon a checksum in Solr.
@test @testdox Tests if the given url is checked upon a checksum in Solr .
public function ifUrlIsSha1Checksum()
    {
        $url = 'https://github.com';
        $solrQuery = $this->getMockBuilder('Solarium\QueryType\Select\Query\Query')
            ->disableOriginalConstructor()
            ->setMethods(['setQuery'])
            ->getMock();
        $expiresBeforeDate = new DateTime();
        $expiresBeforeDate->modify('-8 hour');
        $solrQuery
            ->expects($this->once())
            ->method('setQuery');
        $solrResult = $this->getMockBuilder('Solarium\Core\Query\Result\Result')
            ->disableOriginalConstructor()
            ->setMethods(['getNumFound'])
            ->getMock();
        $solrResult->expects($this->once())
            ->method('getNumFound')
            ->will($this->returnValue(1));
        $solrClient = $this->getMockBuilder('Solarium\Client')
            ->setConstructorArgs([])
            ->setMethods(['createSelect', 'select'])
            ->getMock();
        $solrClient->expects($this->once())
            ->method('createSelect')
            ->will($this->returnValue($solrQuery));
        $solrClient->expects($this->once())
            ->method('select')
            ->will($this->returnValue($solrResult));
        $indexer = new Indexer($solrClient, [], 50);
        $actual = $indexer->isUrlIndexedAndNotExpired($url, ['core' => 'coreName']);
        $this->assertTrue($actual);
    }
public function ifUrlIsSha1Checksum ( ) { $ url = 'https://github.com' ; $ solrQuery = $ this -> getMockBuilder ( 'Solarium\QueryType\Select\Query\Query' ) -> disableOriginalConstructor ( ) -> setMethods ( [ 'setQuery' ] ) -> getMock ( ) ; $ expiresBeforeDate = new DateTime ( ) ; $ expiresBeforeDate -> modify ( '-8 hour' ) ; $ solrQuery -> expects ( $ this -> once ( ) ) -> method ( 'setQuery' ) ; $ solrResult = $ this -> getMockBuilder ( 'Solarium\Core\Query\Result\Result' ) -> disableOriginalConstructor ( ) -> setMethods ( [ 'getNumFound' ] ) -> getMock ( ) ; $ solrResult -> expects ( $ this -> once ( ) ) -> method ( 'getNumFound' ) -> will ( $ this -> returnValue ( 1 ) ) ; $ solrClient = $ this -> getMockBuilder ( 'Solarium\Client' ) -> setConstructorArgs ( [ ] ) -> setMethods ( [ 'createSelect' , 'select' ] ) -> getMock ( ) ; $ solrClient -> expects ( $ this -> once ( ) ) -> method ( 'createSelect' ) -> will ( $ this -> returnValue ( $ solrQuery ) ) ; $ solrClient -> expects ( $ this -> once ( ) ) -> method ( 'select' ) -> will ( $ this -> returnValue ( $ solrResult ) ) ; $ indexer = new Indexer ( $ solrClient , [ ] , 50 ) ; $ actual = $ indexer -> isUrlIndexedAndNotExpired ( $ url , [ 'core' => 'coreName' ] ) ; $ this -> assertTrue ( $ actual ) ; }
@test
 @testdox Tests if the given url is checked upon a checksum in Solr.
@test @testdox Tests if the given url is checked upon a checksum in Solr .