You are here

public function SmsFrameworkProviderTest::testNoSendNoMessage in SMS Framework 8

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

Ensures validation failure if no message.

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testNoSendNoMessage() {
  $sms_message = SmsMessage::create()
    ->setDirection(Direction::OUTGOING)
    ->addRecipients($this
    ->randomPhoneNumbers());
  $this
    ->setExpectedException(SmsException::class, 'Can not queue SMS message because there are 1 validation error(s): [message]: This value should not be null.');
  $this->smsProvider
    ->queue($sms_message);
}