You are here

public function BrowserTestBaseTest::testCheckForMetaRefresh in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testCheckForMetaRefresh()

Tests the ::checkForMetaRefresh() method.

File

core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php, line 788

Class

BrowserTestBaseTest
Tests BrowserTestBase functionality.

Namespace

Drupal\FunctionalTests

Code

public function testCheckForMetaRefresh() {

  // Disable following redirects in the client.
  $this
    ->getSession()
    ->getDriver()
    ->getClient()
    ->followRedirects(FALSE);

  // Set the maximumMetaRefreshCount to zero to make sure the redirect doesn't
  // happen when doing a drupalGet.
  $this->maximumMetaRefreshCount = 0;
  $this
    ->drupalGet('test-meta-refresh');
  $this
    ->assertNotEmpty($this
    ->cssSelect('meta[http-equiv="refresh"]'));

  // Allow one redirect to happen.
  $this->maximumMetaRefreshCount = 1;
  $this
    ->checkForMetaRefresh();

  // Check that we are now on the test page.
  $this
    ->assertSession()
    ->pageTextContains('Test page text.');
}