1 batch.test BatchProcessingTestCase::testBatchFormProgrammatic()

Test batches defined in a programmatically submitted form.

File

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

Class

BatchProcessingTestCase
Tests for the Batch API.

Code

function testBatchFormProgrammatic() {
  // Batches 1, 2 and 3 are triggered in sequence by different submit
  // handlers. Each submit handler modify the submitted 'value'.
  $value = 'sample-value-from-menu';
  $this->backdropGet('batch-test/programmatic/' . $value);
  // Check that result messages are present and in the correct order.
  $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.'));
  // The stack contains execution order of batch callbacks and submit handlers
  // and logging of corresponding $form_state[{values'].
  $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.'));
  $this->assertText('Got out of a programmatic batched form.', t('Page execution continues normally.'));
}