Tests/IndexerTest.php
/**
     * @test
     * @testdox Test if docuemnt are deleted from solr
     */
@test
@testdox Test if docuemnt are deleted from solr
@test @testdox Test if docuemnt are deleted from solr
public function ifDocumentAreDeleted()
    {
        $url = 'https://www.github.com';
        $solrQuery = $this->getMockBuilder('Solarium\QueryType\Update\Query\Query')
            ->disableOriginalConstructor()
            ->setMethods(['addDeleteById', 'addCommit'])
            ->getMock();
        $solrQuery->expects($this->once())
            ->method('addDeleteById')
            ->with(sha1(strtolower($url)));
        $solrClient = $this
            ->getMockBuilder('Solarium\Client')
            ->setMethods(['createUpdate', 'update'])
            ->getMock();
        $solrClient->expects($this->any())
            ->method('createUpdate')
            ->will($this->returnValue($solrQuery));
        $mapping = [];
        $indexer = new Indexer($solrClient, $mapping, 50);
        $bodyCrawlJob = json_encode(
            [
                'url' => $url,
                'metadata' => ['core' => 'core2']
            ]
        );
        $message = new AMQPMessage($bodyCrawlJob);
        $indexer->deleteDocument($message);
    }
public function ifDocumentAreDeleted ( ) { $ url = 'https://www.github.com' ; $ solrQuery = $ this -> getMockBuilder ( 'Solarium\QueryType\Update\Query\Query' ) -> disableOriginalConstructor ( ) -> setMethods ( [ 'addDeleteById' , 'addCommit' ] ) -> getMock ( ) ; $ solrQuery -> expects ( $ this -> once ( ) ) -> method ( 'addDeleteById' ) -> with ( sha1 ( strtolower ( $ url ) ) ) ; $ solrClient = $ this -> getMockBuilder ( 'Solarium\Client' ) -> setMethods ( [ 'createUpdate' , 'update' ] ) -> getMock ( ) ; $ solrClient -> expects ( $ this -> any ( ) ) -> method ( 'createUpdate' ) -> will ( $ this -> returnValue ( $ solrQuery ) ) ; $ mapping = [ ] ; $ indexer = new Indexer ( $ solrClient , $ mapping , 50 ) ; $ bodyCrawlJob = json_encode ( [ 'url' => $ url , 'metadata' => [ 'core' => 'core2' ] ] ) ; $ message = new AMQPMessage ( $ bodyCrawlJob ) ; $ indexer -> deleteDocument ( $ message ) ; }
@test
 @testdox Test if docuemnt are deleted from solr
@test @testdox Test if docuemnt are deleted from solr