function CronQueueTestCase::testCallable

Tests worker defined as a class method callable.

File

drupal/modules/system/system.test, line 991
Tests for system.module.

Class

CronQueueTestCase
Test execution of the cron queue.

Code

function testCallable() {
  $queue = DrupalQueue::get('cron_queue_test_callback');

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

  // Run cron; the worker should perform the task and delete the item from the
  // queue.
  $this
    ->cronRun();

  // The queue should be empty.
  $this
    ->assertEqual($queue
    ->numberOfItems(), 0);
}