public function SmsFrameworkTestTrait::resetTestMessages in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::resetTestMessages()
- 2.1.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::resetTestMessages()
Resets SMS messages stored in memory by 'Memory' gateway.
Parameters
\Drupal\sms\Entity\SmsGatewayInterface|null $sms_gateway: A gateway plugin, or NULL to reset all messages.
5 calls to SmsFrameworkTestTrait::resetTestMessages()
- SmsBlastBrowserTest::testSendBlast in modules/
sms_blast/ tests/ src/ Functional/ SmsBlastBrowserTest.php - Tests sending SMS blast.
- SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage in tests/
src/ Kernel/ SmsFrameworkPhoneNumberProviderTest.php - Ensure default behaviour is to send one phone number per entity.
- SmsFrameworkPhoneNumberProviderTest::testSendMessageUnverified in tests/
src/ Kernel/ SmsFrameworkPhoneNumberProviderTest.php - Tests SMS message sent to entities with unverified phone number.
- SmsFrameworkPhoneNumberProviderTest::testSendMessageVerified in tests/
src/ Kernel/ SmsFrameworkPhoneNumberProviderTest.php - Tests SMS message sent to entities with verified phone number.
- SmsFrameworkUserAccountRegistrationServiceTest::testUnrecognisedCreateUserPhoneNumberRecognised in modules/
sms_user/ tests/ src/ Kernel/ SmsFrameworkUserAccountRegistrationServiceTest.php - Test a user is not created if the sender phone number is already used.
File
- tests/
src/ Functional/ SmsFrameworkTestTrait.php, line 91
Class
- SmsFrameworkTestTrait
- Shared SMS Framework helpers for kernel and web tests.
Namespace
Drupal\Tests\sms\FunctionalCode
public function resetTestMessages(SmsGatewayInterface $sms_gateway = NULL) {
$sms_messages = \Drupal::state()
->get('sms_test_gateway.memory.send', []);
if ($sms_gateway) {
$sms_messages[$sms_gateway
->id()] = [];
}
else {
$sms_messages = [];
}
\Drupal::state()
->set('sms_test_gateway.memory.send', $sms_messages);
}