You are here

public function SmsFrameworkProcessorTest::testIncomingMissingReports in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/SmsFrameworkProcessorTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProcessorTest::testIncomingMissingReports()
  2. 2.1.x tests/src/Kernel/SmsFrameworkProcessorTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProcessorTest::testIncomingMissingReports()

Ensure exception thrown if incoming message is missing recipient reports.

@covers ::ensureReportsPreprocess

File

tests/src/Kernel/SmsFrameworkProcessorTest.php, line 93

Class

SmsFrameworkProcessorTest
Tests functionality provided by the SMS message event subscriber.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testIncomingMissingReports() {
  $result = new SmsMessageResult();
  $sms_message = SmsMessage::create()
    ->setDirection(Direction::INCOMING)
    ->setMessage($this
    ->randomString())
    ->addRecipients($this
    ->randomPhoneNumbers())
    ->setGateway($this->gatewayMemory)
    ->setResult($result);
  $recipient_count = count($sms_message
    ->getRecipients());
  $this
    ->setExpectedException(SmsPluginReportException::class, "Missing reports for {$recipient_count} recipient(s).");
  $this->smsProvider
    ->queue($sms_message);
}