You are here

public function SmsFrameworkGatewayPluginTest::testIncomingEvent in SMS Framework 8

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

Tests if incoming event is fired on a gateway plugin.

File

tests/src/Kernel/SmsFrameworkGatewayPluginTest.php, line 37

Class

SmsFrameworkGatewayPluginTest
Tests SMS Framework gateway plugins.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testIncomingEvent() {
  $gateway = $this
    ->createMemoryGateway()
    ->setSkipQueue(TRUE);
  $gateway
    ->save();
  $sms_message = SmsMessage::create()
    ->setDirection(Direction::INCOMING)
    ->setMessage($this
    ->randomString())
    ->addRecipients($this
    ->randomPhoneNumbers())
    ->setGateway($gateway);
  $sms_message
    ->setResult($this
    ->createMessageResult($sms_message));
  $this->smsProvider
    ->queue($sms_message);
  $this
    ->assertTrue(\Drupal::state()
    ->get('sms_test_gateway.memory.incoming'));
}