You are here

public function SmsFrameworkProviderTest::testSend in SMS Framework 8

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

Test message is sent immediately.

@covers ::send

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testSend() {
  $message = $this
    ->createSmsMessage()
    ->addRecipients($this
    ->randomPhoneNumbers());
  $sms_messages = $this->smsProvider
    ->send($message);
  $this
    ->assertEquals(1, count($sms_messages), 'Return value contains 1 item.');
  $this
    ->assertTrue($sms_messages[0] instanceof StandardSmsMessageInterface, 'Return value is a SMS message.');
  $this
    ->assertEquals(1, count($this
    ->getTestMessages($this->gateway)));
  $this
    ->assertTrue($sms_messages[0]
    ->getResult() instanceof SmsMessageResultInterface);
}