diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index a75ade4..14c85d1 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -54,6 +54,16 @@ protected $headers; /** + * Indicates that headers should be dumped if verbose output is enabled. + * + * Headers are dumped to verbose by drupalGet(), drupalHead(), and + * drupalPost(). + * + * @var bool + */ + protected $dumpHeaders = FALSE; + + /** * The content of the page currently loaded in the internal browser. * * @var string @@ -1191,9 +1201,15 @@ protected function drupalGet($path, array $options = array(), array $headers = a if ($new = $this->checkForMetaRefresh()) { $out = $new; } - $this->verbose('GET request to: ' . $path . - '
Ending URL: ' . $this->getUrl() . - '
' . $out); + + $verbose = 'GET request to: ' . $path . + '
Ending URL: ' . $this->getUrl(); + if ($this->dumpHeaders) { + $verbose .= '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; + } + $verbose .= '
' . $out; + + $this->verbose($verbose); return $out; } @@ -1373,10 +1389,16 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a if ($new = $this->checkForMetaRefresh()) { $out = $new; } - $this->verbose('POST request to: ' . $path . - '
Ending URL: ' . $this->getUrl() . - '
Fields: ' . highlight_string('' . $out); + + $verbose = 'POST request to: ' . $path; + $verbose .= '
Ending URL: ' . $this->getUrl(); + if ($this->dumpHeaders) { + $verbose .= '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'; + } + $verbose .= '
Fields: ' . highlight_string('' . $out; + + $this->verbose($verbose); return $out; } } @@ -1633,6 +1655,13 @@ protected function drupalHead($path, array $options = array(), array $headers = $options['absolute'] = TRUE; $out = $this->curlExec(array(CURLOPT_NOBODY => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_HTTPHEADER => $headers)); $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up. + + if ($this->dumpHeaders) { + $this->verbose('GET request to: ' . $path . + '
Ending URL: ' . $this->getUrl() . + '
Headers:
' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '
'); + } + return $out; } diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php index 8ee5bba..253c463 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php @@ -14,6 +14,8 @@ */ class PageCacheTest extends WebTestBase { + protected $dumpHeaders = TRUE; + /** * Modules to enable. *