You are here

function ProcessingTest::testBatchFormMultistep in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Batch/ProcessingTest.php \Drupal\system\Tests\Batch\ProcessingTest::testBatchFormMultistep()

Tests batches defined in a multistep form.

File

core/modules/system/src/Tests/Batch/ProcessingTest.php, line 97
Contains \Drupal\system\Tests\Batch\ProcessingTest.

Class

ProcessingTest
Tests batch processing in form and non-form workflow.

Namespace

Drupal\system\Tests\Batch

Code

function testBatchFormMultistep() {
  $this
    ->drupalGet('batch-test/multistep');
  $this
    ->assertNoEscaped('<', 'No escaped markup is present.');
  $this
    ->assertText('step 1', 'Form is displayed in step 1.');

  // First step triggers batch 1.
  $this
    ->drupalPostForm(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.');
  $this
    ->assertNoEscaped('<', 'No escaped markup is present.');

  // Second step triggers batch 2.
  $this
    ->drupalPostForm(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.');
  $this
    ->assertNoEscaped('<', 'No escaped markup is present.');
}