You are here

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

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

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
    ->expectException(RecipientRouteException::class);
  $this
    ->expectExceptionMessage('There are no recipients');
  $this->smsProvider
    ->send($sms_message);
  $this
    ->assertEquals(0, count($this
    ->getTestMessages($this->gateway)));
}