function CronQueueTest::testRequeueException

Same name in other branches
  1. 11.x core/modules/system/tests/src/Kernel/System/CronQueueTest.php \Drupal\Tests\system\Kernel\System\CronQueueTest::testRequeueException()

Tests requeue exception is handled properly.

@covers \Drupal\Core\Queue\RequeueException

See also

\Drupal\cron_queue_test\Plugin\QueueWorker\CronQueueTestRequeueException

File

core/modules/system/tests/src/Kernel/System/CronQueueTest.php, line 270

Class

CronQueueTest
Tests the Cron Queue runner.

Namespace

Drupal\Tests\system\Kernel\System

Code

public function testRequeueException() : void {
    // Test the requeueing functionality.
    $queue = $this->container
        ->get('queue')
        ->get(CronQueueTestRequeueException::PLUGIN_ID);
    $queue->createItem([]);
    $this->cron
        ->run();
    $this->assertEquals(2, \Drupal::state()->get('cron_queue_test_requeue_exception'));
    $this->assertEquals(0, $queue->numberOfItems());
}

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