You are here

public function SmsFrameworkProcessorTest::testOutgoingNoResult in SMS Framework 8

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

Ensure exception thrown if gateway send method did not return a result.

@covers ::ensureReportsPreprocess

File

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

Class

SmsFrameworkProcessorTest
Tests functionality provided by the SMS message event subscriber.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testOutgoingNoResult() {
  $this
    ->setFallbackGateway($this->gatewayOutgoingResult);
  \Drupal::state()
    ->set('sms_test_gateway.memory_outgoing_result.missing_result', TRUE);

  // 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());
  $this
    ->setExpectedException(SmsPluginReportException::class, 'Missing result for message.');
  $this->smsProvider
    ->queue($sms_message);
}