You are here

protected function SmsFrameworkDeliveryReportUpdateTest::buildDeliveryReportRequest in SMS Framework 2.x

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

Builds a request containing a JSON-encoded delivery report.

Parameters

string $message_id: The delivery report message ID.

string $recipient: The delivery report recipient number.

string $status: The message delivery status.

int $status_time: The time for the current status update.

Return value

\Symfony\Component\HttpFoundation\Request A request object containing JSON-encoded delivery reports.

1 call to SmsFrameworkDeliveryReportUpdateTest::buildDeliveryReportRequest()
SmsFrameworkDeliveryReportUpdateTest::testDeliveryReportUpdate in tests/src/Kernel/SmsFrameworkDeliveryReportUpdateTest.php
Tests that delivery reports are updated after initial sending.

File

tests/src/Kernel/SmsFrameworkDeliveryReportUpdateTest.php, line 129

Class

SmsFrameworkDeliveryReportUpdateTest
Tests the update of SMS Delivery report entities.

Namespace

Drupal\Tests\sms\Kernel

Code

protected function buildDeliveryReportRequest($message_id, $recipient, $status, $status_time) {
  $reports[] = [
    'message_id' => $message_id,
    'recipient' => $recipient,
    'status' => $status,
    'status_time' => $status_time,
    'status_message' => 'Message ' . $status,
  ];
  $request = new Request();
  $request->request
    ->set('delivery_report', Json::encode([
    'reports' => $reports,
  ]));
  return $request;
}