summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/batch_test.callbacks.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-03 02:42:25 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-03 02:42:25 +0000
commit10244a9d7836d971e670b54c0273325ba65c51da (patch)
tree6c1fc61f9445abf13c16b9a1580ccaadf80f1a84 /modules/simpletest/tests/batch_test.callbacks.inc
parentf45d9a2892bbb27e70d4be78afdbdd31c4058cca (diff)
downloadbrdo-10244a9d7836d971e670b54c0273325ba65c51da.tar.gz
brdo-10244a9d7836d971e670b54c0273325ba65c51da.tar.bz2
- Patch #600836 by tim.cosgrove, dww, naxoc: batch API never terminates if you set ['finished'] > 1.
Diffstat (limited to 'modules/simpletest/tests/batch_test.callbacks.inc')
-rw-r--r--modules/simpletest/tests/batch_test.callbacks.inc24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/simpletest/tests/batch_test.callbacks.inc b/modules/simpletest/tests/batch_test.callbacks.inc
index 5f24757ee..8e03c0ba6 100644
--- a/modules/simpletest/tests/batch_test.callbacks.inc
+++ b/modules/simpletest/tests/batch_test.callbacks.inc
@@ -12,6 +12,7 @@
*/
function _batch_test_callback_1($id, $sleep, &$context) {
// No-op, but ensure the batch take a couple iterations.
+ // Batch needs time to run for the test, so sleep a bit.
usleep($sleep);
// Track execution, and store some result for post-processing in the
// 'finished' callback.
@@ -33,6 +34,7 @@ function _batch_test_callback_2($start, $total, $sleep, &$context) {
$limit = 5;
for ($i = 0; $i < $limit && $context['sandbox']['count'] < $total; $i++) {
// No-op, but ensure the batch take a couple iterations.
+ // Batch needs time to run for the test, so sleep a bit.
usleep($sleep);
// Track execution, and store some result for post-processing in the
// 'finished' callback.
@@ -52,6 +54,21 @@ function _batch_test_callback_2($start, $total, $sleep, &$context) {
}
/**
+ * Simple batch operation.
+ */
+function _batch_test_callback_5($id, $sleep, &$context) {
+ // No-op, but ensure the batch take a couple iterations.
+ // Batch needs time to run for the test, so sleep a bit.
+ usleep($sleep);
+ // Track execution, and store some result for post-processing in the
+ // 'finished' callback.
+ batch_test_stack("op 5 id $id");
+ $context['results'][5][] = $id;
+ // This test is to test finished > 1
+ $context['finished'] = 3.14;
+}
+
+/**
* Batch operation setting up its own batch.
*/
function _batch_test_nested_batch_callback() {
@@ -116,3 +133,10 @@ function _batch_test_finished_3($success, $results, $operations) {
function _batch_test_finished_4($success, $results, $operations) {
_batch_test_finished_helper(4, $success, $results, $operations);
}
+
+/**
+ * 'finished' callback for batch 5.
+ */
+function _batch_test_finished_5($success, $results, $operations) {
+ _batch_test_finished_helper(5, $success, $results, $operations);
+}