function ProcessingTest::testDrupalFormSubmitInBatch

Tests that drupal_form_submit() can run within a batch operation.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Batch/ProcessingTest.php, line 140
Definition of Drupal\system\Tests\Batch\ProcessingTest.

Class

ProcessingTest
Tests the Batch API.

Namespace

Drupal\system\Tests\Batch

Code

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(), array(
    'mock form submitted with value = ' . $value,
  ), 'drupal_form_submit() ran successfully within a batch operation.');
}