summaryrefslogtreecommitdiff
path: root/modules/system/system.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system/system.test')
-rw-r--r--modules/system/system.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index f4fb047d1..cae5cc789 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -867,6 +867,44 @@ class CronRunTestCase extends DrupalWebTestCase {
}
}
+/**
+ * Test execution of the cron queue.
+ */
+class CronQueueTestCase extends DrupalWebTestCase {
+ /**
+ * Implement getInfo().
+ */
+ public static function getInfo() {
+ return array(
+ 'name' => 'Cron queue functionality',
+ 'description' => 'Tests the cron queue runner.',
+ 'group' => 'System'
+ );
+ }
+
+ function setUp() {
+ parent::setUp(array('common_test', 'common_test_cron_helper'));
+ }
+
+ /**
+ * Tests that exceptions thrown by workers are handled properly.
+ */
+ function testExceptions() {
+ $queue = DrupalQueue::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.');
+ }
+
+}
+
class AdminMetaTagTestCase extends DrupalWebTestCase {
/**
* Implement getInfo().