Tests/Unit/Consume/ImportSyncConsumerTest.php
/**
     * Tests logic of ImportSyncConsumer when wrong item is provided.
     */
Tests logic of ImportSyncConsumer when wrong item is provided.
Tests logic of ImportSyncConsumer when wrong item is provided .
public function testImportSyncWrongItem()
    {
        $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', 'Unexpected content: expected ImportItem, got ArrayIterator.', []);
        $import = new ImportSyncConsumer($mockManager, $mockStorage);
        $event = new ItemPipelineEvent(new \ArrayIterator());
        $import->setLogger($mockLogger);
        $import->onConsume($event);
    }
public function testImportSyncWrongItem ( ) { $ 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' , 'Unexpected content: expected ImportItem, got ArrayIterator.' , [ ] ) ; $ import = new ImportSyncConsumer ( $ mockManager , $ mockStorage ) ; $ event = new ItemPipelineEvent ( new \ ArrayIterator ( ) ) ; $ import -> setLogger ( $ mockLogger ) ; $ import -> onConsume ( $ event ) ; }
Tests logic of ImportSyncConsumer when wrong item is provided.
Tests logic of ImportSyncConsumer when wrong item is provided .