1 batch.test BatchProcessingTestCase::testBatchFormMultistep()

Test batches defined in a multistep form.

File

core/modules/simpletest/tests/batch.test, line 71
Tests for the Batch API.

Class

BatchProcessingTestCase
Tests for the Batch API.

Code

function testBatchFormMultistep() {
  $this->backdropGet('batch-test/multistep');
  $this->assertText('step 1', t('Form is displayed in step 1.'));

  // First step triggers batch 1.
  $this->backdropPost(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->backdropPost(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.'));
}