function CronQueueTestCase::testCallable
Tests worker defined as a class method callable.
File
-
modules/
system/ system.test, line 1007
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.