WebformEntityPrintAttachmentFunctionalTest.php in Webform 8.5
File
modules/webform_entity_print_attachment/tests/src/Functional/WebformEntityPrintAttachmentFunctionalTest.php
View source
<?php
namespace Drupal\Tests\webform_entity_print_attachment\Functional;
use Drupal\Tests\webform_entity_print\Functional\WebformEntityPrintFunctionalTestBase;
use Drupal\webform\Entity\Webform;
class WebformEntityPrintAttachmentFunctionalTest extends WebformEntityPrintFunctionalTestBase {
public static $modules = [
'webform_entity_print_attachment_test',
];
public function testEntityPrintAttachment() {
$webform = Webform::load('test_entity_print_attachment');
$this
->drupalLogin($this->rootUser);
$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");
}
}