You are here

public function CronTest::testProcessQueues in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/CronTest.php \Drupal\Tests\Core\CronTest::testProcessQueues()

Tests the ::processQueues() method.

@covers ::processQueues @dataProvider processQueuesTestData

File

core/tests/Drupal/Tests/Core/CronTest.php, line 180

Class

CronTest
Tests the Cron class.

Namespace

Drupal\Tests\Core

Code

public function testProcessQueues($item, $message_logged_assertion, $count_post_run) {
  $this
    ->resetTestingState();
  $this->queue
    ->createItem($item);
  $this
    ->assertFalse($this->state
    ->get('cron_test.message_logged'));
  $this
    ->assertEquals(1, $this->queue
    ->numberOfItems());
  $this->cron
    ->run();
  $this
    ->{$message_logged_assertion}($this->state
    ->get('cron_test.message_logged'));
  $this
    ->assertEquals($count_post_run, $this->queue
    ->numberOfItems());
}