protected function UiHelperTrait::checkForMetaRefresh in Drupal 9
Same name and namespace in other branches
- 8 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 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;
}