You are here

function batch_test_stack in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/batch_test/batch_test.module \batch_test_stack()
  2. 7 modules/simpletest/tests/batch_test.module \batch_test_stack()

Helper function: Stores or retrieves traced execution data.

30 calls to batch_test_stack()
BatchTestChainedForm::batchTestChainedFormSubmit1 in core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php
Form submission handler #1 for batch_test_chained_form.
BatchTestChainedForm::batchTestChainedFormSubmit2 in core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php
Form submission handler #2 for batch_test_chained_form.
BatchTestChainedForm::batchTestChainedFormSubmit3 in core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php
Form submission handler #3 for batch_test_chained_form.
BatchTestChainedForm::batchTestChainedFormSubmit4 in core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php
Form submission handler #4 for batch_test_chained_form.
BatchTestController::testFinishRedirect in core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php
Fires a batch process without a form submission and a finish redirect.

... See full list

File

core/modules/system/tests/modules/batch_test/batch_test.module, line 226
Helper module for the Batch API tests.

Code

function batch_test_stack($data = NULL, $reset = FALSE) {
  $state = \Drupal::state();
  if ($reset) {
    $state
      ->delete('batch_test.stack');
  }
  if (!isset($data)) {
    return $state
      ->get('batch_test.stack');
  }
  $stack = $state
    ->get('batch_test.stack');
  $stack[] = $data;
  $state
    ->set('batch_test.stack', $stack);
}