You are here

public function ProcessingTest::testDrupalFormSubmitInBatch in Drupal 8

Same name and namespace in other branches
  1. 9 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.');
}