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. 10 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()

Test form submission during a batch operation.

File

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

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->assertEqual(batch_test_stack(), [
        'mock form submitted with value = ' . $value,
    ], '\\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.