Issue #889338 by dawehner, das-peter, yched, heddn, frankcarey: Add support for Xdebug in DrupalWebTestCase

merge-requests/26/head
David Rothstein 2015-03-30 17:17:14 -04:00
parent c0f687ed41
commit 86974af08b
2 changed files with 19 additions and 8 deletions

View File

@ -1,6 +1,7 @@
Drupal 7.36, xxxx-xx-xx (development version)
-----------------------
- Added basic support for Xdebug when running automated tests.
- Fixed a bug which caused previewing a node to remove elements from the node
being edited. With this fix, calling node_preview() will no longer modify the
passed-in node object (minor API change).

View File

@ -1769,14 +1769,24 @@ class DrupalWebTestCase extends DrupalTestCase {
protected function curlExec($curl_options, $redirect = FALSE) {
$this->curlInitialize();
// cURL incorrectly handles URLs with a fragment by including the
// fragment in the request to the server, causing some web servers
// to reject the request citing "400 - Bad Request". To prevent
// this, we strip the fragment from the request.
// TODO: Remove this for Drupal 8, since fixed in curl 7.20.0.
if (!empty($curl_options[CURLOPT_URL]) && strpos($curl_options[CURLOPT_URL], '#')) {
$original_url = $curl_options[CURLOPT_URL];
$curl_options[CURLOPT_URL] = strtok($curl_options[CURLOPT_URL], '#');
if (!empty($curl_options[CURLOPT_URL])) {
// Forward XDebug activation if present.
if (isset($_COOKIE['XDEBUG_SESSION'])) {
$options = drupal_parse_url($curl_options[CURLOPT_URL]);
$options += array('query' => array());
$options['query'] += array('XDEBUG_SESSION_START' => $_COOKIE['XDEBUG_SESSION']);
$curl_options[CURLOPT_URL] = url($options['path'], $options);
}
// cURL incorrectly handles URLs with a fragment by including the
// fragment in the request to the server, causing some web servers
// to reject the request citing "400 - Bad Request". To prevent
// this, we strip the fragment from the request.
// TODO: Remove this for Drupal 8, since fixed in curl 7.20.0.
if (strpos($curl_options[CURLOPT_URL], '#')) {
$original_url = $curl_options[CURLOPT_URL];
$curl_options[CURLOPT_URL] = strtok($curl_options[CURLOPT_URL], '#');
}
}
$url = empty($curl_options[CURLOPT_URL]) ? curl_getinfo($this->curlHandle, CURLINFO_EFFECTIVE_URL) : $curl_options[CURLOPT_URL];