You are here

public function PageTest::testBatchProgressMessages in Drupal 9

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

Tests that the progress messages are correct.

File

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

Class

PageTest
Tests the content of the progress page.

Namespace

Drupal\Tests\system\Functional\Batch

Code

public function testBatchProgressMessages() {

  // Go to the initial step only.
  $this->maximumMetaRefreshCount = 0;
  $this
    ->drupalGet('batch-test/test-title');

  // Check that the initial progress message appears correctly and is not
  // double escaped.
  $this
    ->assertSession()
    ->responseContains('<div class="progress__description">Initializing.<br />&nbsp;</div>');
  $this
    ->assertSession()
    ->responseNotContains('&amp;nbsp;');

  // Now also go to the next step.
  $this->maximumMetaRefreshCount = 1;
  $this
    ->drupalGet('batch-test/test-title');

  // Check that the progress message for second step appears correctly.
  $this
    ->assertSession()
    ->responseContains('<div class="progress__description">Completed 1 of 1.</div>');
}