You are here

public function ProcessingTest::testDrupalFormSubmitInBatch in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testDrupalFormSubmitInBatch()

Tests form submission during a batch operation.

File

core/modules/system/tests/src/Functional/Batch/ProcessingTest.php, line 199

Class

ProcessingTest
Tests batch processing in form and non-form workflow.

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testDrupalFormSubmitInBatch() {

  // Displaying the page triggers a batch that programmatically submits a
  // form.
  $value = rand(0, 255);
  $this
    ->drupalGet('batch-test/nested-programmatic/' . $value);
  $this
    ->assertEquals([
    'mock form submitted with value = ' . $value,
  ], batch_test_stack(), '\\Drupal::formBuilder()->submitForm() ran successfully within a batch operation.');
}