You are here

public function SmsFrameworkProviderTest::testIncomingNoRecipients in SMS Framework 8

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

Ensures incoming message without recipients do not trigger exception.

File

tests/src/Kernel/SmsFrameworkProviderTest.php, line 159

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testIncomingNoRecipients() {
  $this->incomingGateway
    ->setSkipQueue(TRUE)
    ->save();
  $sms_message = SmsMessage::create()
    ->setMessage($this
    ->randomString())
    ->setGateway($this->incomingGateway)
    ->setDirection(Direction::INCOMING);
  $sms_message
    ->setResult($this
    ->createMessageResult($sms_message));
  $this->smsProvider
    ->queue($sms_message);
  $messages = $this
    ->getIncomingMessages($this->incomingGateway);
  $this
    ->assertEquals(1, count($messages), 'Message was added to incoming queue without recipients.');
}