You are here

public function WebformEntityPrintAttachmentFunctionalTest::testEntityPrintAttachment in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_entity_print_attachment/tests/src/Functional/WebformEntityPrintAttachmentFunctionalTest.php \Drupal\Tests\webform_entity_print_attachment\Functional\WebformEntityPrintAttachmentFunctionalTest::testEntityPrintAttachment()

Test entity print attachment.

File

modules/webform_entity_print_attachment/tests/src/Functional/WebformEntityPrintAttachmentFunctionalTest.php, line 23

Class

WebformEntityPrintAttachmentFunctionalTest
Webform entity print attachment test.

Namespace

Drupal\Tests\webform_entity_print_attachment\Functional

Code

public function testEntityPrintAttachment() {
  $webform = Webform::load('test_entity_print_attachment');
  $this
    ->drupalLogin($this->rootUser);

  /**************************************************************************/

  // Check that the PDF attachment is added to the sent email.
  $this
    ->postSubmission($webform);
  $sent_email = $this
    ->getLastEmail();
  $this
    ->assertEquals('entity_print_pdf_html.pdf', $sent_email['params']['attachments'][0]['filename'], "The PDF attachment's file name");
  $this
    ->assertEquals('application/pdf', $sent_email['params']['attachments'][0]['filemime'], "The PDF attachment's file mime type");
  $this
    ->assertEquals('Using testprintengine', $sent_email['params']['attachments'][0]['filecontent'], "The attachment's file content");
}