public function SmsFrameworkSmsSendTest::testSmsSendSpecified in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/SmsFrameworkSmsSendTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkSmsSendTest::testSmsSendSpecified()
- 2.1.x tests/src/Kernel/SmsFrameworkSmsSendTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkSmsSendTest::testSmsSendSpecified()
Tests overriding default gateway with message option.
File
- tests/
src/ Kernel/ SmsFrameworkSmsSendTest.php, line 84
Class
- SmsFrameworkSmsSendTest
- Tests sending SMS messages.
Namespace
Drupal\Tests\sms\KernelCode
public function testSmsSendSpecified() {
$test_gateway1 = $this
->createMemoryGateway([
'skip_queue' => TRUE,
]);
$test_gateway2 = $this
->createMemoryGateway([
'skip_queue' => TRUE,
]);
$this
->setFallbackGateway($test_gateway1);
$sms_message = (new SmsMessage())
->addRecipients($this
->randomPhoneNumbers(1))
->setMessage($this
->randomString())
->setGateway($test_gateway2);
$sms_messages = $this->defaultSmsProvider
->send($sms_message);
$this
->assertTrue($sms_messages[0]
->getResult() instanceof SmsMessageResultInterface, 'Message successfully sent.');
$this
->assertEquals(0, count($this
->getTestMessages($test_gateway1)), 'Message not sent to the default gateway.');
$this
->assertEquals(1, count($this
->getTestMessages($test_gateway2)), 'Message sent to the specified gateway.');
}