function DrupalMinkClient::getMetaRefreshUrl

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

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;
}

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