Tests batches defined in a multistep form.
function testBatchFormMultistep() {
$this
->drupalGet('batch-test/multistep');
$this
->assertText('step 1', 'Form is displayed in step 1.');
// First step triggers batch 1.
$this
->drupalPost(NULL, array(), 'Submit');
$this
->assertBatchMessages($this
->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.');
$this
->assertEqual(batch_test_stack(), $this
->_resultStack('batch_1'), 'Execution order was correct.');
$this
->assertText('step 2', 'Form is displayed in step 2.');
// Second step triggers batch 2.
$this
->drupalPost(NULL, array(), 'Submit');
$this
->assertBatchMessages($this
->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.');
$this
->assertEqual(batch_test_stack(), $this
->_resultStack('batch_2'), 'Execution order was correct.');
$this
->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}