You are here

public function CronTest::testRequeueException in Drupal 10

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

Verify that RequeueException causes an item to be processed multiple times.

File

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

Class

CronTest
Tests the Cron class.

Namespace

Drupal\Tests\Core

Code

public function testRequeueException() {
  $this
    ->resetTestingState();
  $this->queue
    ->createItem('RequeueException');
  $this->cron
    ->run();

  // Fetch the number of times this item was requeued.
  $actual_requeue_count = $this->state
    ->get('cron_test.requeue_count');

  // Make sure the item was requeued at least once.
  $this
    ->assertIsInt($actual_requeue_count);

  // Ensure that the actual requeue count matches the expected value.
  $this
    ->assertEquals(self::REQUEUE_COUNT, $actual_requeue_count);
}