You are here

public function SmsFrameworkProviderTest::testSendNoDirection in SMS Framework 8

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

Ensures direction is set by the provider.

@covers ::send

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testSendNoDirection() {
  $sms_message = SmsMessage::create()
    ->setMessage($this
    ->randomString())
    ->addRecipients($this
    ->randomPhoneNumbers())
    ->setGateway($this->gateway);

  // This method will set direction.
  $this->smsProvider
    ->send($sms_message);
  $messages = $this
    ->getTestMessages($this->gateway);
  $this
    ->assertEquals(1, count($messages), 'Message was added to outgoing queue without direction being explicitly set');
  $this
    ->assertEquals(Direction::OUTGOING, $messages[0]
    ->getDirection(), 'Message direction set to outgoing.');
}