You are here

public function SmsFrameworkProviderTest::testNoRecipients in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 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 340

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

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