You are here

public function DaysTest::testProcess in Message 8

Same name in this branch
  1. 8 tests/src/Unit/Plugin/MessagePurge/DaysTest.php \Drupal\Tests\message\Unit\Plugin\MessagePurge\DaysTest::testProcess()
  2. 8 tests/src/Kernel/Plugin/MessagePurge/DaysTest.php \Drupal\Tests\message\Kernel\Plugin\MessagePurge\DaysTest::testProcess()

Tests processing more than defined queue item limit.

@covers ::process

File

tests/src/Unit/Plugin/MessagePurge/DaysTest.php, line 41

Class

DaysTest
Unit tests for the days purge plugin.

Namespace

Drupal\Tests\message\Unit\Plugin\MessagePurge

Code

public function testProcess() {
  $query = $this
    ->prophesize(QueryInterface::class)
    ->reveal();
  $request_stack = $this
    ->prophesize(RequestStack::class)
    ->reveal();
  $queue = $this
    ->prophesize(QueueInterface::class);
  $queue
    ->createItem(Argument::size(MessagePurgeInterface::MESSAGE_DELETE_SIZE))
    ->shouldBeCalledTimes(1);
  $queue
    ->createItem(Argument::size(1))
    ->shouldBeCalledTimes(1);
  $plugin = new Days([], 'days', [], $query, $queue
    ->reveal(), $request_stack);
  $messages = range(1, MessagePurgeInterface::MESSAGE_DELETE_SIZE + 1);
  $plugin
    ->process($messages);
}