You are here

public function PrintableFormatConfigureTabsTest::testGetDerivativeDefinitions in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Plugin/Derivative/PrintableFormatConfigureTabsTest.php \Drupal\Tests\printable\Unit\Plugin\Derivative\PrintableFormatConfigureTabsTest::testGetDerivativeDefinitions()

Tests getting the plugin label from the plugin.

@covers PrintableFormatConfigureTabs::GetDerivativeDefinitions

File

tests/src/Unit/Plugin/Derivative/PrintableFormatConfigureTabsTest.php, line 31

Class

PrintableFormatConfigureTabsTest
Tests the printable configuration tabs plugin derivative.

Namespace

Drupal\Tests\printable\Unit\Plugin\Derivative

Code

public function testGetDerivativeDefinitions() {
  $printable_format_manager = $this
    ->getMockBuilder('Drupal\\printable\\PrintableFormatPluginManager')
    ->disableOriginalConstructor()
    ->getMock();
  $printable_format_manager
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->will($this
    ->returnValue([
    'foo' => [
      'title' => 'Foo',
    ],
    'bar' => [
      'title' => 'Bar',
    ],
  ]));
  $derivative = new PrintableFormatConfigureTabs($printable_format_manager);
  $expected = [
    'foo' => [
      'title' => 'Foo',
      'route_parameters' => [
        'printable_format' => 'foo',
      ],
      'route_name' => 'printable.format_configure_foo',
    ],
    'bar' => [
      'title' => 'Bar',
      'route_parameters' => [
        'printable_format' => 'bar',
      ],
      'route_name' => 'printable.format_configure_bar',
    ],
  ];
  $this
    ->assertEquals($expected, $derivative
    ->getDerivativeDefinitions([]));
}