function CronTest::testRequeueException

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/CronTest.php \Drupal\Tests\Core\CronTest::testRequeueException()
  2. 11.x 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 208

Class

CronTest
Tests the Cron class.

Namespace

Drupal\Tests\Core

Code

public function testRequeueException() : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.