You are here

protected function SmsFrameworkTestTrait::getIncomingMessages in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::getIncomingMessages()
  2. 2.1.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::getIncomingMessages()

Get all messages received by a gateway.

Parameters

\Drupal\sms\Entity\SmsGatewayInterface $sms_gateway: A gateway plugin instance.

Return value

\Drupal\sms\Message\SmsMessageInterface[] An array of messages received by a gateway.

4 calls to SmsFrameworkTestTrait::getIncomingMessages()
SmsFrameworkIncomingBrowserTest::testIncomingRouteEndpoint in tests/src/Functional/SmsFrameworkIncomingBrowserTest.php
Test incoming route endpoint provided by 'incoming' gateway.
SmsFrameworkProviderTest::testIncomingNoDirection in tests/src/Kernel/SmsFrameworkProviderTest.php
Ensures direction is set by the provider.
SmsFrameworkProviderTest::testIncomingNoRecipients in tests/src/Kernel/SmsFrameworkProviderTest.php
Ensures incoming message without recipients do not trigger exception.
SmsFrameworkProviderTest::testIncomingNotChunked in tests/src/Kernel/SmsFrameworkProviderTest.php
Test incoming messages do not get chunked.

File

tests/src/Functional/SmsFrameworkTestTrait.php, line 112

Class

SmsFrameworkTestTrait
Shared SMS Framework helpers for kernel and web tests.

Namespace

Drupal\Tests\sms\Functional

Code

protected function getIncomingMessages(SmsGatewayInterface $sms_gateway) {
  $gateway_id = $sms_gateway
    ->id();
  $sms_messages = \Drupal::state()
    ->get('sms_test_gateway.memory.incoming', []);
  return isset($sms_messages[$gateway_id]) ? $sms_messages[$gateway_id] : [];
}