You are here

function FormAPITestCase::testDrupalFormSubmitInBatch in SimpleTest 7

Check that we can run drupal_form_submit during a batch.

File

tests/form.test, line 350
Unit tests for the Drupal Form API.

Class

FormAPITestCase
Test using drupal_form_submit in a batch.

Code

function testDrupalFormSubmitInBatch() {

  // Our test is going to modify the following variable.
  variable_set('form_test_mock_submit', 'initial_state');

  // This is a page that sets a batch, which calls drupal_form_submit, which
  // modifies the variable we set up above.
  $this
    ->drupalGet('form_test/drupal_form_submit_batch_api');

  // If the drupal_form_submit call executed correctly our test variable will be
  // set to 'form_submitted'.
  $this
    ->assertEqual('form_submitted', variable_get('form_test_mock_submit', 'initial_state'), t('Check drupal_form_submit called submit handlers when running in a batch'));

  // Clean our variable up.
  variable_del('form_test_mock_submit');
}