You are here

public function SmsFrameworkQueueTest::testRetentionUnlimited in SMS Framework 8

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

Test retention is set to keep messages forever.

File

tests/src/Kernel/SmsFrameworkQueueTest.php, line 188

Class

SmsFrameworkQueueTest
Tests behaviour of SMS Framework message queue.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testRetentionUnlimited() {
  $this->gateway
    ->setRetentionDuration(Direction::OUTGOING, -1)
    ->save();
  $this
    ->createSmsMessage()
    ->setGateway($this->gateway)
    ->setQueued(FALSE)
    ->setProcessedTime(1)
    ->save();

  // Garbage collect.
  $this->cronService
    ->run();
  $this
    ->assertEquals(1, count(SmsMessage::loadMultiple()), 'There are SMS entities in storage.');
}