protected function SmsFrameworkTestTrait::resetIncomingMessages in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::resetIncomingMessages()
- 2.1.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::resetIncomingMessages()
Resets incoming messages stored in memory by gateway.
Parameters
\Drupal\sms\Entity\SmsGatewayInterface|null $sms_gateway: A gateway plugin, or NULL to reset all messages.
File
- tests/
src/ Functional/ SmsFrameworkTestTrait.php, line 138
Class
- SmsFrameworkTestTrait
- Shared SMS Framework helpers for kernel and web tests.
Namespace
Drupal\Tests\sms\FunctionalCode
protected function resetIncomingMessages(SmsGatewayInterface $sms_gateway = NULL) {
$sms_messages = \Drupal::state()
->get('sms_test_gateway.memory.incoming', []);
if ($sms_gateway) {
$sms_messages[$sms_gateway
->id()] = [];
}
else {
$sms_messages = [];
}
\Drupal::state()
->set('sms_test_gateway.memory.incoming', $sms_messages);
}