You are here

public function SmsFrameworkQueueTest::testProcessUnqueued in SMS Framework 8

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

Tests unqueued unprocessed messages are added to the Drupal queue system.

File

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

Class

SmsFrameworkQueueTest
Tests behaviour of SMS Framework message queue.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testProcessUnqueued() {
  $sms_message = $this
    ->createSmsMessage();
  $result = $this->smsProvider
    ->queue($sms_message);
  $id = $result[0]
    ->id();

  // Call processUnqueued manually so cron does not send the message with
  // queue workers.
  $this->smsQueueProcessor
    ->processUnqueued();
  $sms_message_saved = SmsMessage::load($id);
  $this
    ->assertTrue($sms_message_saved
    ->isQueued(), 'SMS message is queued.');
  $this
    ->assertEquals(1, \Drupal::queue('sms.messages')
    ->numberOfItems(), 'SMS message processor queue item created.');
}