function BatchTestCallbacks::callback6

Implements callback_batch_operation().

Performs a simple batch operation.

File

core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php, line 123

Class

BatchTestCallbacks
Batch callbacks for testing batches.

Namespace

Drupal\batch_test

Code

public function callback6($id, $sleep, &$context) : void {
    $batch_test_helper = new BatchTestHelper();
    // 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_helper->stack("op 6 id {$id}");
    $context['results'][6][] = $id;
}

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