function _batch_test_set_file_callback_1

Implements callback_batch_operation().

Performs a simple batch operation.

1 string reference to '_batch_test_set_file_callback_1'
BatchBuilderTest::testSetFile in core/tests/Drupal/Tests/Core/Batch/BatchBuilderTest.php
Tests setFile().

File

core/modules/system/tests/modules/batch_test/batch_test.set_file.inc, line 18

Code

function _batch_test_set_file_callback_1($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 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.