public function SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage()
- 2.1.x tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage()
Ensure default behaviour is to send one phone number per entity.
@covers ::sendMessage
File
- tests/
src/ Kernel/ SmsFrameworkPhoneNumberProviderTest.php, line 227
Class
- SmsFrameworkPhoneNumberProviderTest
- Tests Phone Number Provider.
Namespace
Drupal\Tests\sms\KernelCode
public function testSendMessageOneMessage() {
$phone_numbers = [
'+123123123',
'+456456456',
];
$entity = $this
->createEntityWithPhoneNumber($this->phoneNumberSettings, $phone_numbers);
$this
->resetTestMessages();
$this
->verifyPhoneNumber($entity, $phone_numbers[0]);
$this
->verifyPhoneNumber($entity, $phone_numbers[1]);
$sms_message = new SmsMessage();
$sms_message
->setMessage($this
->randomString());
$this->phoneNumberProvider
->sendMessage($entity, $sms_message);
$message = $this
->getLastTestMessage($this->gateway);
$this
->assertEquals([
$phone_numbers[0],
], $message
->getRecipients(), 'The SMS message is using the first phone number from the entity.');
}