You are here

public function SmsFrameworkMessageTestTrait::testRecipients in SMS Framework 8

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

Tests recipients for SMS messages.

@covers ::getRecipients

File

tests/src/Functional/SmsFrameworkMessageTestTrait.php, line 61

Class

SmsFrameworkMessageTestTrait
SMS Message object test trait.

Namespace

Drupal\Tests\sms\Functional

Code

public function testRecipients() {
  $sms_message0 = $this
    ->createSmsMessage();
  $sms_message1 = $this
    ->createSmsMessage();
  $sms_message1
    ->addRecipients([
    '1234567890',
  ]);
  $sms_message2 = $this
    ->createSmsMessage();
  $sms_message2
    ->addRecipients([
    '1234567890',
    '9087654321',
  ]);

  // Test that getRecipients return arrays.
  $this
    ->assertEquals([], $sms_message0
    ->getRecipients());
  $this
    ->assertEquals([
    '1234567890',
  ], $sms_message1
    ->getRecipients());
  $this
    ->assertEquals([
    '1234567890',
    '9087654321',
  ], $sms_message2
    ->getRecipients());
}