You are here

public function EntityPrintOrderRendererTest::testGetFilename in Commerce Core 8.2

Tests the generated filename.

File

modules/order/tests/src/Kernel/EntityPrintOrderRendererTest.php, line 43

Class

EntityPrintOrderRendererTest
Tests the entity_print integration.

Namespace

Drupal\Tests\commerce_order\Kernel

Code

public function testGetFilename() {
  $sut = $this->entityTypeManager
    ->getHandler('commerce_order', 'entity_print');
  assert($sut instanceof OrderRenderer);
  $order = Order::create([
    'id' => '123',
    'type' => 'default',
  ]);
  $filename = $sut
    ->getFilename([
    $order,
  ]);
  $this
    ->assertEquals('Order document receipt', (string) $filename);
  $second_order = Order::create([
    'id' => '789',
    'type' => 'default',
  ]);
  $filename = $sut
    ->getFilename([
    $order,
    $second_order,
  ]);
  $this
    ->assertEquals('Order document receipts', (string) $filename);
}