function UiHelperTrait::checkForMetaRefresh
Same name and namespace in other branches
- 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.
11 calls to UiHelperTrait::checkForMetaRefresh()
- UpdateSchemaTest::testUpdateHooks in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateSchemaTest.php - Tests that update hooks are properly run.
- UpdateScriptTest::runUpdates in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Helper function to run updates via the browser.
- UpdateScriptTest::testRequirements in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests that requirements warnings and errors are correctly displayed.
- UpdateScriptTest::testSuccessfulMultilingualUpdateFunctionality in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests performing updates with update.php in a multilingual environment.
- UpdateScriptTest::testSuccessfulUpdateFunctionality in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests update.php after performing a successful update.
File
-
core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 533
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.