function BatchProcessingTestCase::testBatchFormMultistep

Test batches defined in a multistep form.

File

modules/simpletest/tests/batch.test, line 77

Class

BatchProcessingTestCase
Tests for the Batch API.

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.