public function SmsFrameworkDeliveryReportEntityTest::testSaveReportWithoutParent in SMS Framework 2.x
Same name and namespace in other branches
- 8 tests/src/Kernel/SmsFrameworkDeliveryReportEntityTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkDeliveryReportEntityTest::testSaveReportWithoutParent()
- 2.1.x tests/src/Kernel/SmsFrameworkDeliveryReportEntityTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkDeliveryReportEntityTest::testSaveReportWithoutParent()
Tests saving a delivery report without a parent SMS message.
@covers ::save @covers ::preSave
File
- tests/
src/ Kernel/ SmsFrameworkDeliveryReportEntityTest.php, line 156
Class
- SmsFrameworkDeliveryReportEntityTest
- Tests the SMS Delivery report entity.
Namespace
Drupal\Tests\sms\KernelCode
public function testSaveReportWithoutParent() {
$this
->expectException(EntityStorageException::class);
$this
->expectExceptionMessage('No parent SMS message specified for SMS delivery report');
/** @var \Drupal\sms\Entity\SmsMessageResult $result */
$result = $this
->createDeliveryReport()
->setMessageId($this
->randomMachineName())
->setStatus(SmsMessageReportStatus::DELIVERED)
->setRecipient('1234567890')
->setStatusMessage('Message delivered')
->setStatusTime($this->container
->get('datetime.time')
->getRequestTime());
$result
->save();
}