You are here

public function ProcessingTest::testBatchRedirectFinishedCallback in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testBatchRedirectFinishedCallback()

Tests batches that redirect in the batch finished callback.

File

core/modules/system/tests/src/Functional/Batch/ProcessingTest.php, line 41

Class

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

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testBatchRedirectFinishedCallback() {

  // Displaying the page triggers batch 1.
  $this
    ->drupalGet('batch-test/finish-redirect');
  $this
    ->assertBatchMessages($this
    ->_resultMessages('batch_1'), 'Batch for step 2 performed successfully.');
  $this
    ->assertEqual(batch_test_stack(), $this
    ->_resultStack('batch_1'), 'Execution order was correct.');
  $this
    ->assertText('Test page text.', 'Custom redirection after batch execution displays the correct page.');
  $this
    ->assertUrl(Url::fromRoute('test_page_test.test_page'));
}