Tests/Event/PersistenceEventListenerTest.php
/**
     * @testdox Test if the revisit_after value is doubled because content or title hasn't changed.
     * @test
     */
@testdox Test if the revisit_after value is doubled because content or title hasn't changed.
@test
@testdox Test if the revisit_after value is doubled because content or title hasn ' t changed . @test
public function isRevisitFactorIncreased()
    {
        $currentDocument = new PersistableDocument();
        $currentDocument['revisit_after'] = 3600;
        $currentDocument['title'] = 'test';
        $currentDocument['strippedContent'] = 'test';
        $indexer = $this
            ->getMockBuilder('Simgroep\ConcurrentSpiderBundle\Indexer')
            ->disableOriginalConstructor()
            ->setMethods(array('findDocumentByUrl'))
            ->getMock();
        $indexer
            ->expects($this->once())
            ->method('findDocumentByUrl')
            ->will($this->returnValue($currentDocument));
        $resource = $this
            ->getMockBuilder('\VDB\Spider\Resource')
            ->disableOriginalConstructor()
            ->getMock();
        $document = new PersistableDocument();
        $document['title'] = 'test';
        $document['strippedContent'] = 'test';
        $document['collection'] = 'test';
        $event = new PersistenceEvent($document, $resource, array());
        $eventListener = new PersistenceEventListener($indexer, 10, 10000, 50);
        $eventListener->onPrePersistDocument($event);
        $this->assertEquals(7200, $document['revisit_after']);
    }
public function isRevisitFactorIncreased ( ) { $ currentDocument = new PersistableDocument ( ) ; $ currentDocument [ 'revisit_after' ] = 3600 ; $ currentDocument [ 'title' ] = 'test' ; $ currentDocument [ 'strippedContent' ] = 'test' ; $ indexer = $ this -> getMockBuilder ( 'Simgroep\ConcurrentSpiderBundle\Indexer' ) -> disableOriginalConstructor ( ) -> setMethods ( array ( 'findDocumentByUrl' ) ) -> getMock ( ) ; $ indexer -> expects ( $ this -> once ( ) ) -> method ( 'findDocumentByUrl' ) -> will ( $ this -> returnValue ( $ currentDocument ) ) ; $ resource = $ this -> getMockBuilder ( '\VDB\Spider\Resource' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ document = new PersistableDocument ( ) ; $ document [ 'title' ] = 'test' ; $ document [ 'strippedContent' ] = 'test' ; $ document [ 'collection' ] = 'test' ; $ event = new PersistenceEvent ( $ document , $ resource , array ( ) ) ; $ eventListener = new PersistenceEventListener ( $ indexer , 10 , 10000 , 50 ) ; $ eventListener -> onPrePersistDocument ( $ event ) ; $ this -> assertEquals ( 7200 , $ document [ 'revisit_after' ] ) ; }
@testdox Test if the revisit_after value is doubled because content or title hasn't changed.
@testdox Test if the revisit_after value is doubled because content or title hasn ' t changed .