You are here

function _batch_test_callback_1 in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_callback_1()
  2. 9 core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_callback_1()

Implements callback_batch_operation().

Simple batch operation.

3 string references to '_batch_test_callback_1'
_batch_test_batch_1 in modules/simpletest/tests/batch_test.module
Batch 1: repeats a simple operation.
_batch_test_batch_3 in modules/simpletest/tests/batch_test.module
Batch 3: both single and multistep operations.
_batch_test_batch_4 in modules/simpletest/tests/batch_test.module
Batch 4: batch within a batch.

File

modules/simpletest/tests/batch_test.callbacks.inc, line 14
Batch callbacks for the Batch API tests.

Code

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.
  batch_test_stack("op 1 id {$id}");
  $context['results'][1][] = $id;
}