You are here

protected function WebformElementFormatTest::getMessageBody in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Functional/Element/WebformElementFormatTest.php \Drupal\Tests\webform\Functional\Element\WebformElementFormatTest::getMessageBody()

Get webform email message body for a webform submission.

Parameters

\Drupal\webform\WebformSubmissionInterface $submission: A webform submission.

string $handler_id: The webform email handler id.

Return value

string The webform email message body for a webform submission.

1 call to WebformElementFormatTest::getMessageBody()
WebformElementFormatTest::testFormat in tests/src/Functional/Element/WebformElementFormatTest.php
Tests element format.

File

tests/src/Functional/Element/WebformElementFormatTest.php, line 295

Class

WebformElementFormatTest
Tests for webform submission webform element custom #format support.

Namespace

Drupal\Tests\webform\Functional\Element

Code

protected function getMessageBody(WebformSubmissionInterface $submission, $handler_id = 'email_html') {

  /** @var \Drupal\webform\Plugin\WebformHandlerMessageInterface $message_handler */
  $message_handler = $submission
    ->getWebform()
    ->getHandler($handler_id);
  $message = $message_handler
    ->getMessage($submission);
  $body = (string) $message['body'];
  $this
    ->verbose($body);
  return $body;
}