You are here

public function BatchTestController::testProgrammatic in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php \Drupal\batch_test\Controller\BatchTestController::testProgrammatic()

Submits the 'Chained' form programmatically.

Programmatic form: the page submits the 'Chained' form through \Drupal::formBuilder()->submitForm().

Parameters

int $value: Some value passed to a the chained form.

Return value

array Render array containing markup.

1 string reference to 'BatchTestController::testProgrammatic'
batch_test.routing.yml in core/modules/system/tests/modules/batch_test/batch_test.routing.yml
core/modules/system/tests/modules/batch_test/batch_test.routing.yml

File

core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php, line 98

Class

BatchTestController
Controller routines for batch tests.

Namespace

Drupal\batch_test\Controller

Code

public function testProgrammatic($value = 1) {
  $form_state = (new FormState())
    ->setValues([
    'value' => $value,
  ]);
  \Drupal::formBuilder()
    ->submitForm('Drupal\\batch_test\\Form\\BatchTestChainedForm', $form_state);
  return [
    'success' => [
      '#markup' => 'Got out of a programmatic batched form.',
    ],
  ];
}