function BrowserTestBaseTest::testCheckForMetaRefresh

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testCheckForMetaRefresh()
  2. 10 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testCheckForMetaRefresh()
  3. 11.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testCheckForMetaRefresh()

Tests the ::checkForMetaRefresh() method.

File

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

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.');
}

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