1 system.test CronQueueTestCase::testExceptions()

Tests that exceptions thrown by workers are handled properly.

File

core/modules/system/tests/system.test, line 806
Tests for system.module.

Class

CronQueueTestCase
Test execution of the cron queue.

Code

function testExceptions() {
  $queue = BackdropQueue::get('cron_queue_test_exception');

  // Enqueue an item for processing.
  $queue->createItem(array($this->randomName() => $this->randomName()));

  // Run cron; the worker for this queue should throw an exception and handle
  // it.
  $this->cronRun();

  // The item should be left in the queue.
  $this->assertEqual($queue->numberOfItems(), 1, 'Failing item still in the queue after throwing an exception.');
}