function PageTest::testBatchProgressPageTitle

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Batch/PageTest.php \Drupal\Tests\system\Functional\Batch\PageTest::testBatchProgressPageTitle()
  2. 8.9.x core/modules/system/tests/src/Functional/Batch/PageTest.php \Drupal\Tests\system\Functional\Batch\PageTest::testBatchProgressPageTitle()
  3. 10 core/modules/system/tests/src/Functional/Batch/PageTest.php \Drupal\Tests\system\Functional\Batch\PageTest::testBatchProgressPageTitle()

Tests that the batch API progress page shows the title correctly.

File

core/modules/system/tests/src/Functional/Batch/PageTest.php, line 56

Class

PageTest
Tests the content of the progress page.

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testBatchProgressPageTitle() : void {
    // Visit an administrative page that runs a test batch, and check that the
    // title shown during batch execution (which the batch callback function
    // saved as a variable) matches the theme used on the administrative page.
    // Run initial step only first.
    $this->maximumMetaRefreshCount = 0;
    $this->drupalGet('batch-test/test-title');
    $this->assertSession()
        ->pageTextContains('Batch Test');
    // Leave the batch process running.
    $this->maximumMetaRefreshCount = NULL;
    $this->drupalGet('batch-test/test-title');
    // The stack should contain the title shown on the progress page.
    $this->assertEquals([
        'Batch Test',
    ], batch_test_stack(), 'The batch title is shown on the batch page.');
    $this->assertSession()
        ->pageTextContains('Redirection successful.');
}

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