You are here

public function FeedQueueWorkerBaseTest::test in Feeds 8.3

Tests various methods on the FeedQueueWorkerBase class.

File

tests/src/Unit/Plugin/QueueWorker/FeedQueueWorkerBaseTest.php, line 21

Class

FeedQueueWorkerBaseTest
@coversDefaultClass \Drupal\feeds\Plugin\QueueWorker\FeedQueueWorkerBase @group feeds

Namespace

Drupal\Tests\feeds\Unit\Plugin\QueueWorker

Code

public function test() {
  $container = new ContainerBuilder();
  $container
    ->set('queue', $this
    ->createMock('Drupal\\Core\\Queue\\QueueFactory', [], [], '', FALSE));
  $container
    ->set('event_dispatcher', new EventDispatcher());
  $container
    ->set('account_switcher', $this
    ->getMockedAccountSwitcher());
  $container
    ->set('entity_type.manager', $this
    ->createMock(EntityTypeManagerInterface::class));
  $plugin = $this
    ->getMockForAbstractClass('Drupal\\feeds\\Plugin\\QueueWorker\\FeedQueueWorkerBase', [], '', FALSE);
  $plugin = $plugin::create($container, [], '', []);
  $method = $this
    ->getProtectedClosure($plugin, 'handleException');
  $method($this
    ->getMockFeed(), new EmptyFeedException());
  $this
    ->expectException(RuntimeException::class);
  $method($this
    ->getMockFeed(), new RuntimeException());
}