You are here

protected function SmsFrameworkTestTrait::createMessageResult in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::createMessageResult()
  2. 2.1.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::createMessageResult()

Create a result and reports for a message.

Parameters

\Drupal\sms\Message\SmsMessageInterface $sms_message: A message object.

Return value

\Drupal\sms\Message\SmsMessageResult A message result with reports for each message recipient.

16 calls to SmsFrameworkTestTrait::createMessageResult()
SmsFrameworkBrowserTest::testQueueReport in tests/src/Functional/SmsFrameworkBrowserTest.php
Tests queue statistics located on Drupal report page.
SmsFrameworkGatewayPluginTest::testIncomingEvent in tests/src/Kernel/SmsFrameworkGatewayPluginTest.php
Tests if incoming event is fired on a gateway plugin.
SmsFrameworkMessageEntityTest::testCascadeDelete in tests/src/Kernel/SmsFrameworkMessageEntityTest.php
Tests cascade delete on the SMS message, result and reports.
SmsFrameworkMessageEntityTest::testConvertToEntityFromStandardSmsMessage in tests/src/Kernel/SmsFrameworkMessageEntityTest.php
Ensure data from standard SMS message are passed to SMS message entity.
SmsFrameworkProviderTest::testEventsIncoming in tests/src/Kernel/SmsFrameworkProviderTest.php
Ensure events are executed when a message is received.

... See full list

File

tests/src/Functional/SmsFrameworkTestTrait.php, line 280

Class

SmsFrameworkTestTrait
Shared SMS Framework helpers for kernel and web tests.

Namespace

Drupal\Tests\sms\Functional

Code

protected function createMessageResult(SmsMessageInterface $sms_message) {
  $reports = array_map(function ($recipient) {
    return (new SmsDeliveryReport())
      ->setRecipient($recipient);
  }, $sms_message
    ->getRecipients());
  return (new SmsMessageResult())
    ->setErrorMessage($this
    ->randomString())
    ->setReports($reports);
}