PrintableFormatConfigureTabsTest.php in Printer and PDF versions for Drupal 8+ 8
File
tests/src/Unit/Plugin/Derivative/PrintableFormatConfigureTabsTest.php
View source
<?php
namespace Drupal\Tests\printable\Unit\Plugin\Derivative;
use Drupal\Tests\UnitTestCase;
use Drupal\printable\Plugin\Derivative\PrintableFormatConfigureTabs;
class PrintableFormatConfigureTabsTest extends UnitTestCase {
public static function getInfo() {
return [
'name' => 'Printable Tabs Plugin Derivative',
'descriptions' => 'Tests the printable tabs plugin derivative class.',
'group' => 'Printable',
];
}
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([]));
}
}