You are here

public function SmsFrameworkProviderTest::testNoRecipients in SMS Framework 8

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

Test an exception is thrown if a message has no recipients.

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

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