function update_test_postupdate_post_update_test_batch

Same name in other branches
  1. 9 core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php \update_test_postupdate_post_update_test_batch()
  2. 10 core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php \update_test_postupdate_post_update_test_batch()
  3. 11.x core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php \update_test_postupdate_post_update_test_batch()

Testing batch processing in post updates update.

1 string reference to 'update_test_postupdate_post_update_test_batch'
UpdatePostUpdateTest::testPostUpdate in core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php
Tests hook_post_update_NAME().

File

core/modules/system/tests/modules/update_test_postupdate/update_test_postupdate.post_update.php, line 55

Code

function update_test_postupdate_post_update_test_batch(&$sandbox = NULL) {
    if (!isset($sandbox['steps'])) {
        $sandbox['current_step'] = 0;
        $sandbox['steps'] = 3;
    }
    $sandbox['current_step']++;
    $execution = \Drupal::state()->get('post_update_test_execution', []);
    $execution[] = __FUNCTION__ . '-' . $sandbox['current_step'];
    \Drupal::state()->set('post_update_test_execution', $execution);
    $sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
    return 'Test post update batches';
}

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