You are here

public function SmsFrameworkMessageTestTrait::testsChunkByRecipients in SMS Framework 8

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

Tests chunk by recipients.

@covers ::chunkByRecipients

File

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

Class

SmsFrameworkMessageTestTrait
SMS Message object test trait.

Namespace

Drupal\Tests\sms\Functional

Code

public function testsChunkByRecipients() {
  $sms_message = $this
    ->createSmsMessage();
  $sms_message
    ->addRecipients([
    '100',
    '200',
    '300',
    '400',
    '500',
  ]);
  $sms_messages = $sms_message
    ->chunkByRecipients(2);
  $this
    ->assertEquals(3, count($sms_messages));
  $this
    ->assertEquals([
    '100',
    '200',
  ], $sms_messages[0]
    ->getRecipients());
  $this
    ->assertEquals([
    '300',
    '400',
  ], $sms_messages[1]
    ->getRecipients());
  $this
    ->assertEquals([
    '500',
  ], $sms_messages[2]
    ->getRecipients());
}