You are here

public function SmsFrameworkProviderTest::testEventsQueueIncomingSkipQueue in SMS Framework 8

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

Tests events for incoming queue skip queue.

Ensure events are executed when a message added to the incoming queue and the gateway is set to skip queue.

File

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

Class

SmsFrameworkProviderTest
Tests SMS Framework provider service.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testEventsQueueIncomingSkipQueue() {
  $this->gateway
    ->setSkipQueue(TRUE)
    ->save();
  $sms_message = $this
    ->createSmsMessage()
    ->setGateway($this->gateway)
    ->setDirection(Direction::INCOMING)
    ->addRecipients($this
    ->randomPhoneNumbers());
  $sms_message
    ->setResult($this
    ->createMessageResult($sms_message));
  $this->smsProvider
    ->queue($sms_message);
  $expected = [
    SmsEvents::MESSAGE_PRE_PROCESS,
    SmsEvents::MESSAGE_QUEUE_PRE_PROCESS,
    SmsEvents::MESSAGE_INCOMING_PRE_PROCESS,
    'Drupal\\sms_test_gateway\\Plugin\\SmsGateway\\Memory::incomingEvent',
    SmsEvents::MESSAGE_INCOMING_POST_PROCESS,
    SmsEvents::MESSAGE_POST_PROCESS,
    SmsEvents::MESSAGE_QUEUE_POST_PROCESS,
  ];
  $execution_order = \Drupal::state()
    ->get('sms_test_event_subscriber__execution_order', []);
  $this
    ->assertEquals($expected, $execution_order);
}