You are here

public function SmsFrameworkDeliveryReportEntityTest::testTimeQueued in SMS Framework 8

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

Tests time queued.

@covers ::getTimeQueued @covers ::setTimeQueued

File

tests/src/Kernel/SmsFrameworkDeliveryReportEntityTest.php, line 66

Class

SmsFrameworkDeliveryReportEntityTest
Tests the SMS Delivery report entity.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testTimeQueued() {
  $report = $this
    ->createDeliveryReport();
  $this
    ->assertNull($report
    ->getTimeQueued(), 'Default value is NULL');

  // Save a version that has QUEUED as the status.
  $sms_message = SmsMessage::create();
  $sms_message
    ->save();
  $time = 123123123;
  $report
    ->setSmsMessage($sms_message)
    ->setStatus(SmsMessageReportStatus::QUEUED)
    ->setStatusTime($time)
    ->save();
  $return = $report
    ->setTimeQueued($time);
  $this
    ->assertTrue($return instanceof SmsDeliveryReportInterface);
  $this
    ->assertEquals($time, $report
    ->getTimeQueued());
}