Tests/Unit/Consume/ImportSyncConsumerTest.php
/**
     * Tests logic of ImportSyncConsumer when there is no sync_id.
     */
Tests logic of ImportSyncConsumer when there is no sync_id.
Tests logic of ImportSyncConsumer when there is no sync_id .
public function testImportSyncNoSyncId()
    {
        $mockManager = $this->getMockBuilder('ONGR\ElasticsearchBundle\ORM\Manager')
            ->disableOriginalConstructor()
            ->getMock();
        $mockStorage = $this->getMockBuilder('ONGR\ConnectionsBundle\Sync\SyncStorage\SyncStorage')
            ->disableOriginalConstructor()
            ->getMock();
        $mockLogger = $this->getMockForAbstractClass('Psr\Log\LoggerInterface');
        $mockLogger
            ->expects($this->once())
            ->method('log')
            ->with('notice', 'Item data does not contain sync_id field.', []);
        $mockDoc = $this->getMockForAbstractClass('ONGR\ElasticsearchBundle\Document\DocumentInterface');
        $mockDoc->expects($this->any())->method('getId')->willReturn(1);
        $import = new ImportSyncConsumer($mockManager, $mockStorage);
        $event = new ItemPipelineEvent(new ImportItem([], $mockDoc));
        $import->setLogger($mockLogger);
        $import->onConsume($event);
    }
public function testImportSyncNoSyncId ( ) { $ mockManager = $ this -> getMockBuilder ( 'ONGR\ElasticsearchBundle\ORM\Manager' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ mockStorage = $ this -> getMockBuilder ( 'ONGR\ConnectionsBundle\Sync\SyncStorage\SyncStorage' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ mockLogger = $ this -> getMockForAbstractClass ( 'Psr\Log\LoggerInterface' ) ; $ mockLogger -> expects ( $ this -> once ( ) ) -> method ( 'log' ) -> with ( 'notice' , 'Item data does not contain sync_id field.' , [ ] ) ; $ mockDoc = $ this -> getMockForAbstractClass ( 'ONGR\ElasticsearchBundle\Document\DocumentInterface' ) ; $ mockDoc -> expects ( $ this -> any ( ) ) -> method ( 'getId' ) -> willReturn ( 1 ) ; $ import = new ImportSyncConsumer ( $ mockManager , $ mockStorage ) ; $ event = new ItemPipelineEvent ( new ImportItem ( [ ] , $ mockDoc ) ) ; $ import -> setLogger ( $ mockLogger ) ; $ import -> onConsume ( $ event ) ; }
Tests logic of ImportSyncConsumer when there is no sync_id.
Tests logic of ImportSyncConsumer when there is no sync_id .