Commit f63db4cf authored by alexpott's avatar alexpott
Browse files

Issue #889338 by das-peter, dawehner, yched: Add support for xdebug in WebTestBase.

parent e689237f
......@@ -1063,6 +1063,24 @@ protected function curlExec($curl_options, $redirect = FALSE) {
// not overwritten by Curl.
$curl_options[CURLOPT_HTTPHEADER][] = 'Expect:';
}
// In order to debug webtests you need to either set a cookie or have the
// xdebug session in the URL. If the developer listens to connection on the
// parent site, by default the cookie is not forwarded to the client side,
// so you can't debug actual running code. In order to make debuggers work
// this bit of information is forwarded. Make sure that the debugger listens
// to at least three external connections.
if (isset($_COOKIE['XDEBUG_SESSION'])) {
$curl_options += array(
CURLOPT_COOKIE => '',
);
// Ensure any existing cookie data string ends with the correct separator.
if (!empty($curl_options[CURLOPT_COOKIE])) {
$curl_options[CURLOPT_COOKIE] = rtrim($curl_options[CURLOPT_COOKIE], '; ') . '; ';
}
$curl_options[CURLOPT_COOKIE] .= 'XDEBUG_SESSION=' . $_COOKIE['XDEBUG_SESSION'] . '; ';
}
curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options);
if (!$redirect) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment