You are here

public function SmsFrameworkQueueTest::testRetentionImmediateDelete in SMS Framework 2.x

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

Test retention is set to delete messages immediately after transmission.

Tests \Drupal\sms\Plugin\QueueWorker\SmsProcessor.

File

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

Class

SmsFrameworkQueueTest
Tests behaviour of SMS Framework message queue.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testRetentionImmediateDelete() {
  $this->gateway
    ->setRetentionDuration(Direction::OUTGOING, 0)
    ->save();
  $sms_message = $this
    ->createSmsMessage();
  $this->smsProvider
    ->queue($sms_message);
  $this->cronService
    ->run();
  $this
    ->assertEquals(1, count($this
    ->getTestMessages($this->gateway)), 'One message was sent.');
  $this
    ->assertEquals(0, count(SmsMessage::loadMultiple()), 'There are no SMS entities in storage.');
}