You are here

public function SmsFrameworkTestTrait::getLastTestMessage in SMS Framework 8

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

Get the last SMS message sent to 'Memory' gateway.

Parameters

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

Return value

\Drupal\sms\Message\SmsMessageInterface|false The last SMS message, or FALSE if no messages have been sent.

7 calls to SmsFrameworkTestTrait::getLastTestMessage()
SmsDevelMessageTest::testVerboseReports in modules/sms_devel/tests/src/Functional/SmsDevelMessageTest.php
Tests verbose message output.
SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage in tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php
Ensure default behaviour is to send one phone number per entity.
SmsFrameworkPhoneNumberTest::testPhoneNumberVerificationMessage in tests/src/Functional/SmsFrameworkPhoneNumberTest.php
Ensure phone number verification SMS sent.
SmsFrameworkUserAccountRegistrationServiceTest::testIncomingPatternNoPlaceholders in modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php
Test if a user is created despite no placeholders.
SmsSendToPhoneBrowserTest::testAdminSettingsAndSendToPhone in modules/sms_sendtophone/tests/src/Functional/SmsSendToPhoneBrowserTest.php
Tests admin settings page and sendtophone node integration.

... See full list

File

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

Class

SmsFrameworkTestTrait
Shared SMS Framework helpers for kernel and web tests.

Namespace

Drupal\Tests\sms\Functional

Code

public function getLastTestMessage(SmsGatewayInterface $sms_gateway) {
  $gateway_id = $sms_gateway
    ->id();
  $sms_messages = \Drupal::state()
    ->get('sms_test_gateway.memory.send', []);
  return isset($sms_messages[$gateway_id]) ? end($sms_messages[$gateway_id]) : FALSE;
}