You are here

public function PdfUsingMpdfOutputTest::testOutput in PDF using mPDF 8.2

Tests if output is a PDF file

Only for the case when PDF is generated and displayed on the browser

File

tests/src/Functional/PdfUsingMpdfOutputTest.php, line 23

Class

PdfUsingMpdfOutputTest
Class PdfUsingMpdfOutputTest @package Drupal\Tests\pdf_using_mpdf\Functional

Namespace

Drupal\Tests\pdf_using_mpdf\Functional

Code

public function testOutput() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalPostForm('admin/people/permissions', [
    'authenticated[generate type_a pdf]' => TRUE,
  ], 'Save permissions');
  $node_type_a = $this
    ->createNode([
    'type' => 'type_a',
  ]);
  $this
    ->drupalGet('node/' . $node_type_a
    ->id() . '/pdf');
  $this
    ->assertResponse(200);
  $this
    ->assertSession()
    ->responseHeaderContains('Content-Type', 'application/pdf');
}