You are here

public function SmsFrameworkQueueTest::testQueueOutgoing in SMS Framework 8

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

Test message is queued and sent on cron run.

File

tests/src/Kernel/SmsFrameworkQueueTest.php, line 105

Class

SmsFrameworkQueueTest
Tests behaviour of SMS Framework message queue.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testQueueOutgoing() {
  $sms_message = $this
    ->createSmsMessage()
    ->setDirection(Direction::OUTGOING);
  $this->smsProvider
    ->queue($sms_message);
  $this
    ->assertEquals(0, count($this
    ->getTestMessages($this->gateway)), 'Message not sent yet.');
  $this->cronService
    ->run();
  $this
    ->assertEquals(1, count($this
    ->getTestMessages($this->gateway)), 'Message was sent.');
}