public function SmsFrameworkProcessorTest::testOutgoingMissingReports in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/SmsFrameworkProcessorTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProcessorTest::testOutgoingMissingReports()
- 2.1.x tests/src/Kernel/SmsFrameworkProcessorTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProcessorTest::testOutgoingMissingReports()
Ensure exception thrown if outgoing message is missing recipient reports.
@covers ::ensureReportsPreprocess
File
- tests/
src/ Kernel/ SmsFrameworkProcessorTest.php, line 136
Class
- SmsFrameworkProcessorTest
- Tests functionality provided by the SMS message event subscriber.
Namespace
Drupal\Tests\sms\KernelCode
public function testOutgoingMissingReports() {
$this
->setFallbackGateway($this->gatewayOutgoingResult);
$delete_count = rand(1, 5);
\Drupal::state()
->set('sms_test_gateway.memory_outgoing_result.delete_reports', $delete_count);
// Must skip queue for send() for post-process to run.
$this->gatewayOutgoingResult
->setSkipQueue(TRUE)
->save();
$sms_message = SmsMessage::create()
->setDirection(Direction::OUTGOING)
->setMessage($this
->randomString())
->addRecipients($this
->randomPhoneNumbers($delete_count + 1));
$this
->setExpectedException(SmsPluginReportException::class, "Missing reports for {$delete_count} recipient(s).");
$this->smsProvider
->queue($sms_message);
}