You are here

public function SmsFrameworkPhoneNumberProviderTest::testSendMessageUnverified in SMS Framework 8

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

Tests SMS message sent to entities with unverified phone number.

@covers ::sendMessage

File

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

Class

SmsFrameworkPhoneNumberProviderTest
Tests Phone Number Provider.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testSendMessageUnverified() {
  $phone_numbers = [
    '+123123123',
  ];
  $entity = $this
    ->createEntityWithPhoneNumber($this->phoneNumberSettings, $phone_numbers);
  $this
    ->resetTestMessages();
  $sms_message = new SmsMessage();
  $sms_message
    ->setSenderNumber('+999888777')
    ->setMessage($this
    ->randomString());
  $this
    ->setExpectedException(NoPhoneNumberException::class);
  $this->phoneNumberProvider
    ->sendMessage($entity, $sms_message);
}