You are here

protected function SmsFrameworkQueueTest::createSmsMessage in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/SmsFrameworkQueueTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkQueueTest::createSmsMessage()
  2. 2.1.x tests/src/Kernel/SmsFrameworkQueueTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkQueueTest::createSmsMessage()

Create a SMS message entity for testing.

Parameters

array $values: An mixed array of values to pass when creating the SMS message entity.

Return value

\Drupal\sms\Entity\SmsMessageInterface A SMS message entity for testing.

3 calls to SmsFrameworkQueueTest::createSmsMessage()
SmsFrameworkQueueTest::testProcessUnqueued in tests/src/Kernel/SmsFrameworkQueueTest.php
Tests unqueued unprocessed messages are added to the Drupal queue system.
SmsFrameworkQueueTest::testRetentionImmediateDelete in tests/src/Kernel/SmsFrameworkQueueTest.php
Test retention is set to delete messages immediately after transmission.
SmsFrameworkQueueTest::testRetentionPersist in tests/src/Kernel/SmsFrameworkQueueTest.php
Test retention is set to keep messages after transmission.

File

tests/src/Kernel/SmsFrameworkQueueTest.php, line 216

Class

SmsFrameworkQueueTest
Tests behaviour of SMS Framework message queue.

Namespace

Drupal\Tests\sms\Kernel

Code

protected function createSmsMessage(array $values = []) {
  return SmsMessage::create($values)
    ->setDirection(Direction::OUTGOING)
    ->setMessage($this
    ->randomString())
    ->addRecipients($this
    ->randomPhoneNumbers(1));
}