function ProcessingTest::testDrupalFormSubmitInBatch

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testDrupalFormSubmitInBatch()
  2. 8.9.x core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testDrupalFormSubmitInBatch()
  3. 11.x 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 200

Class

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

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testDrupalFormSubmitInBatch() : void {
    // 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.');
}

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