function BatchProcessingTestCase::testDrupalFormSubmitInBatch in Drupal 7
Test that drupal_form_submit() can run within a batch operation.
File
- modules/
simpletest/ tests/ batch.test, line 132 - Tests for the Batch API.
Class
- BatchProcessingTestCase
- Tests for the Batch API.
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,
), t('drupal_form_submit() ran successfully within a batch operation.'));
}