function _batch_test_callback_1

Same name in other branches
  1. 7.x modules/simpletest/tests/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()
  3. 8.9.x core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_callback_1()
  4. 10 core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_callback_1()

Implements callback_batch_operation().

Performs a simple batch operation.

4 string references to '_batch_test_callback_1'
BatchBuilderTest::testSetFile in core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php
Tests setFile().
_batch_test_batch_1 in core/modules/system/tests/modules/batch_test/batch_test.module
Batch 1: Repeats a simple operation.
_batch_test_batch_3 in core/modules/system/tests/modules/batch_test/batch_test.module
Batch 3: Performs both single and multistep operations.
_batch_test_batch_4 in core/modules/system/tests/modules/batch_test/batch_test.module
Batch 4: Performs a batch within a batch.

File

core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc, line 19

Code

function _batch_test_callback_1($id, $sleep, &$context) {
    // No-op, but ensure the batch takes 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.