function CronQueueTestCase::testCallable in Drupal 7
Tests worker defined as a class method callable.
File
- 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);
}