You are here

public function SmsFrameworkProcessorTest::testIncomingUnSupported in SMS Framework 8

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

Tests exception is thrown if gateway does not support incoming messages.

@covers ::ensureIncomingSupport

File

tests/src/Kernel/SmsFrameworkProcessorTest.php, line 176

Class

SmsFrameworkProcessorTest
Tests functionality provided by the SMS message event subscriber.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testIncomingUnSupported() {
  $gateway = $this
    ->createMemoryGateway([
    'plugin' => 'capabilities_default',
  ]);
  $sms_message = SmsMessage::create()
    ->setDirection(Direction::INCOMING)
    ->setMessage($this
    ->randomString())
    ->addRecipients($this
    ->randomPhoneNumbers())
    ->setGateway($gateway);
  $this
    ->setExpectedException(SmsException::class, "Gateway `" . $gateway
    ->id() . "` does not support incoming messages.");
  $this->smsProvider
    ->queue($sms_message);
}