Reverting #554106. Causes failures in path-related tests.
parent
a10e162270
commit
5a4fdae4e3
|
@ -1237,7 +1237,8 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
$curl_options = $this->additionalCurlOptions + array(
|
$curl_options = $this->additionalCurlOptions + array(
|
||||||
CURLOPT_COOKIEJAR => $this->cookieFile,
|
CURLOPT_COOKIEJAR => $this->cookieFile,
|
||||||
CURLOPT_URL => $base_url,
|
CURLOPT_URL => $base_url,
|
||||||
CURLOPT_FOLLOWLOCATION => FALSE,
|
CURLOPT_FOLLOWLOCATION => TRUE,
|
||||||
|
CURLOPT_MAXREDIRS => 5,
|
||||||
CURLOPT_RETURNTRANSFER => TRUE,
|
CURLOPT_RETURNTRANSFER => TRUE,
|
||||||
CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https.
|
CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https.
|
||||||
CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https.
|
CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https.
|
||||||
|
@ -1388,7 +1389,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
$this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
|
$this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
|
||||||
|
|
||||||
// Replace original page output with new output from redirected page(s).
|
// Replace original page output with new output from redirected page(s).
|
||||||
if (($new = $this->checkForRedirect())) {
|
if (($new = $this->checkForMetaRefresh())) {
|
||||||
$out = $new;
|
$out = $new;
|
||||||
}
|
}
|
||||||
$this->verbose('GET request to: ' . $path .
|
$this->verbose('GET request to: ' . $path .
|
||||||
|
@ -1478,7 +1479,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
$this->refreshVariables();
|
$this->refreshVariables();
|
||||||
|
|
||||||
// Replace original page output with new output from redirected page(s).
|
// Replace original page output with new output from redirected page(s).
|
||||||
if (($new = $this->checkForRedirect())) {
|
if (($new = $this->checkForMetaRefresh())) {
|
||||||
$out = $new;
|
$out = $new;
|
||||||
}
|
}
|
||||||
$this->verbose('POST request to: ' . $path .
|
$this->verbose('POST request to: ' . $path .
|
||||||
|
@ -1498,22 +1499,14 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for meta refresh tag or HTTP location header.
|
* Check for meta refresh tag and if found call drupalGet() recursively. This
|
||||||
*
|
|
||||||
* If either redirect indicators are found call drupalGet() recursively. This
|
|
||||||
* function looks for the http-equiv attribute to be set to "Refresh"
|
* function looks for the http-equiv attribute to be set to "Refresh"
|
||||||
* and is case-sensitive.
|
* and is case-sensitive.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* Either the new page content or FALSE.
|
* Either the new page content or FALSE.
|
||||||
*/
|
*/
|
||||||
protected function checkForRedirect() {
|
protected function checkForMetaRefresh() {
|
||||||
foreach ($this->headers as $header) {
|
|
||||||
if (strpos($header, 'Location') !== FALSE) {
|
|
||||||
return $this->drupalGet(trim(str_replace('Location:', '', $header)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->drupalGetContent() != '' && $this->parse()) {
|
if ($this->drupalGetContent() != '' && $this->parse()) {
|
||||||
$refresh = $this->xpath('//meta[@http-equiv="Refresh"]');
|
$refresh = $this->xpath('//meta[@http-equiv="Refresh"]');
|
||||||
if (!empty($refresh)) {
|
if (!empty($refresh)) {
|
||||||
|
|
Loading…
Reference in New Issue