You are here

private function DrupalMinkClient::getMetaRefreshUrl in Drupal 8

Glean the meta refresh URL from the current page content.

Return value

string|null Either the redirect URL that was found, or NULL if none was found.

1 call to DrupalMinkClient::getMetaRefreshUrl()
DrupalMinkClient::request in core/tests/Drupal/BuildTests/Framework/DrupalMinkClient.php
Calls a URI.

File

core/tests/Drupal/BuildTests/Framework/DrupalMinkClient.php, line 43

Class

DrupalMinkClient
Extend the Mink client for Drupal use-cases.

Namespace

Drupal\BuildTests\Framework

Code

private function getMetaRefreshUrl() {
  $metaRefresh = $this
    ->getCrawler()
    ->filter('meta[http-equiv="Refresh"], meta[http-equiv="refresh"]');
  foreach ($metaRefresh
    ->extract([
    'content',
  ]) as $content) {
    if (preg_match('/^\\s*0\\s*;\\s*URL\\s*=\\s*(?|\'([^\']++)|"([^"]++)|([^\'"].*))/i', $content, $m)) {
      return str_replace("\t\r\n", '', rtrim($m[1]));
    }
  }
  return NULL;
}