1 backdrop_web_test_case.php protected BackdropWebTestCase::checkForMetaRefresh()

Check for meta refresh tag and if found call backdropGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.

Return value

Either the new page content or FALSE.:

File

core/modules/simpletest/backdrop_web_test_case.php, line 2606

Class

BackdropWebTestCase
Test case for typical Backdrop tests.

Code

protected function checkForMetaRefresh() {
  if (strpos($this->backdropGetContent(), '<meta ') && $this->parse()) {
    $refresh = $this->xpath('//meta[@http-equiv="Refresh"]');
    if (!empty($refresh)) {
      // Parse the content attribute of the meta tag for the format:
      // "[delay]: URL=[page_to_redirect_to]".
      if (preg_match('/\d+;\s*URL=(?P<url>.*)/i', $refresh[0]['content'], $match)) {
        return $this->backdropGet($this->getAbsoluteUrl(decode_entities($match['url'])));
      }
    }
  }
  return FALSE;
}