You are here

public function SmsFrameworkProviderTest::testNoSendNoRecipients in SMS Framework 8

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

Ensure no messages sent if no recipients.

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testNoSendNoRecipients() {
  $sms_message = SmsMessage::create()
    ->setDirection(Direction::OUTGOING)
    ->setMessage($this
    ->randomString());
  $this
    ->setExpectedException(RecipientRouteException::class, 'There are no recipients');
  $this->smsProvider
    ->send($sms_message);
  $this
    ->assertEquals(0, count($this
    ->getTestMessages($this->gateway)));
}