summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-12 00:54:08 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-12 00:54:08 -0400
commit3d1be9b5ca8cf7baadeb2e86665c080526d805cf (patch)
treeb5858dba12b203000fb2e661a4c86d28644c8905 /modules
parent890d98ac96b578206733236ecc23acaf57585454 (diff)
downloadbrdo-3d1be9b5ca8cf7baadeb2e86665c080526d805cf.tar.gz
brdo-3d1be9b5ca8cf7baadeb2e86665c080526d805cf.tar.bz2
Issue #2342667 by claudiu.cristea, Dave Reid, ndobromirov: Cron and batch processing of queues are not accepting callables
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.test19
-rw-r--r--modules/system/tests/cron_queue_test.module12
2 files changed, 30 insertions, 1 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index 6e5f2b358..2865bbb25 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -923,7 +923,7 @@ class CronQueueTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp(array('common_test', 'common_test_cron_helper'));
+ parent::setUp(array('common_test', 'common_test_cron_helper', 'cron_queue_test'));
}
/**
@@ -943,6 +943,23 @@ class CronQueueTestCase extends DrupalWebTestCase {
$this->assertEqual($queue->numberOfItems(), 1, 'Failing item still in the queue after throwing an exception.');
}
+ /**
+ * Tests worker defined as a class method callable.
+ */
+ 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);
+ }
+
}
class AdminMetaTagTestCase extends DrupalWebTestCase {
diff --git a/modules/system/tests/cron_queue_test.module b/modules/system/tests/cron_queue_test.module
index e95c6b6af..0df6396a6 100644
--- a/modules/system/tests/cron_queue_test.module
+++ b/modules/system/tests/cron_queue_test.module
@@ -7,9 +7,21 @@ function cron_queue_test_cron_queue_info() {
$queues['cron_queue_test_exception'] = array(
'worker callback' => 'cron_queue_test_exception',
);
+ $queues['cron_queue_test_callback'] = array(
+ 'worker callback' => array('CronQueueTestCallbackClass', 'foo'),
+ );
+
return $queues;
}
function cron_queue_test_exception($item) {
throw new Exception('That is not supposed to happen.');
}
+
+class CronQueueTestCallbackClass {
+
+ static public function foo() {
+ // Do nothing.
+ }
+
+}