You are here

public function EntityPrintTest::testGenerateFilename in Entity Print 8

Test safe file generation.

@covers ::generateFilename @dataProvider generateFilenameDataProvider

File

tests/src/Unit/EntityPrintTest.php, line 19

Class

EntityPrintTest
@coversDefaultClass \Drupal\entity_print\EntityPrintPdfBuilder @group entity_print

Namespace

Drupal\Tests\entity_print\Unit

Code

public function testGenerateFilename($entity_label, $expected_filename) {
  $entity = $this
    ->getMockEntity($entity_label);
  $pdf_builder = $this
    ->getMockPdfBuilder();
  $reflection = new \ReflectionClass($pdf_builder);
  $method = $reflection
    ->getMethod('generateFilename');
  $method
    ->setAccessible(true);
  $this
    ->assertEquals($expected_filename, $method
    ->invoke($pdf_builder, $entity));
}