function UiHelperTrait::checkForMetaRefresh
Same name in other branches
- 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::checkForMetaRefresh()
- 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::checkForMetaRefresh()
- 11.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::checkForMetaRefresh()
Checks for meta refresh tag and if found call drupalGet() recursively.
This function looks for the http-equiv attribute to be set to "Refresh" and is case-insensitive.
Return value
string|false Either the new page content or FALSE.
20 calls to UiHelperTrait::checkForMetaRefresh()
- AddFeedTest::testFeedLabelEscaping in core/
modules/ aggregator/ tests/ src/ Functional/ AddFeedTest.php - Ensures that the feed label is escaping when rendering the feed icon.
- BigPipeTest::performMetaRefresh in core/
modules/ big_pipe/ tests/ src/ Functional/ BigPipeTest.php - Performs a single <meta> refresh explicitly.
- BrowserTestBaseTest::testCheckForMetaRefresh in core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php - Tests the ::checkForMetaRefresh() method.
- BrowserWithJavascriptTest::drupalGetWithAlert in core/
tests/ Drupal/ FunctionalJavascriptTests/ BrowserWithJavascriptTest.php - Retrieves a Drupal path or an absolute path.
- UiHelperTrait::drupalGet in core/
tests/ Drupal/ Tests/ UiHelperTrait.php - Retrieves a Drupal path or an absolute path.
File
-
core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 526
Class
- UiHelperTrait
- Provides UI helper methods.
Namespace
Drupal\TestsCode
protected function checkForMetaRefresh() {
$refresh = $this->cssSelect('meta[http-equiv="Refresh"], meta[http-equiv="refresh"]');
if (!empty($refresh) && (!isset($this->maximumMetaRefreshCount) || $this->metaRefreshCount < $this->maximumMetaRefreshCount)) {
// Parse the content attribute of the meta tag for the format:
// "[delay]: URL=[page_to_redirect_to]".
if (preg_match('/\\d+;\\s*URL=\'?(?<url>[^\']*)/i', $refresh[0]->getAttribute('content'), $match)) {
$this->metaRefreshCount++;
return $this->drupalGet($this->getAbsoluteUrl(Html::decodeEntities($match['url'])));
}
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.