You are here

protected function PrintLinkTest::getBlock in Entity Print 8.2

Gets a block plugin for testing.

Parameters

array $config: The block configuration.

Return value

\Drupal\entity_print\Plugin\Block\PrintLinks The loaded block.

File

tests/src/Kernel/PrintLinkTest.php, line 62

Class

PrintLinkTest
Test the print links block.

Namespace

Drupal\Tests\entity_print\Kernel

Code

protected function getBlock(array $config = []) {
  $manager = $this->container
    ->get('plugin.manager.block');
  $entity = $this
    ->createMock('Drupal\\Core\\Entity\\EntityInterface');
  $context = new Context(ContextDefinition::create(), $entity);

  /** @var \Drupal\entity_print\Plugin\Block\PrintLinks $block */
  $block = $manager
    ->createInstance('print_links', $config);
  $block
    ->setContext('entity', $context);
  return $block;
}