You are here

protected function WebformCompositeFormatTest::getMessageBody in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Functional/Composite/WebformCompositeFormatTest.php \Drupal\Tests\webform\Functional\Composite\WebformCompositeFormatTest::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 WebformCompositeFormatTest::getMessageBody()
WebformCompositeFormatTest::testFormat in tests/src/Functional/Composite/WebformCompositeFormatTest.php
Tests element format.

File

tests/src/Functional/Composite/WebformCompositeFormatTest.php, line 227

Class

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

Namespace

Drupal\Tests\webform\Functional\Composite

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;
}