function ProcessingTest::testBatchRedirectFinishedCallback

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testBatchRedirectFinishedCallback()
  2. 8.9.x core/modules/system/tests/src/Functional/Batch/ProcessingTest.php \Drupal\Tests\system\Functional\Batch\ProcessingTest::testBatchRedirectFinishedCallback()
  3. 11.x 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 42

Class

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

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testBatchRedirectFinishedCallback() : void {
    // Displaying the page triggers batch 1.
    $this->drupalGet('batch-test/finish-redirect');
    $this->assertBatchMessages($this->_resultMessages('batch_1'));
    $this->assertEquals($this->_resultStack('batch_1'), batch_test_stack(), 'Execution order was correct.');
    // Verify that the custom redirection after batch execution displays the
    // correct page.
    $this->assertSession()
        ->pageTextContains('Test page text.');
    $this->assertSession()
        ->addressEquals(Url::fromRoute('test_page_test.test_page'));
}

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