Updated: Comment #0
Problem/Motivation
In WebTestBase::curlExec() we copy the XDEBUG cookie from the parent request to the child request.
This does not work for CLI requests, however, because in that case the XDEBUG information is not stored in $_COOKIE, but in $_SERVER.
Proposed resolution
Check for $_SERVER['XDEBUG_CONFIG']
and if that is present, turn that into an XDebug cookie on the child site.
Remaining tasks
The current patch assumes a very specific format of the XDEBUG_CONFIG
key. It is the most common format, but I'm not sure how safe that assumption is. The alternative would be to somehow parse the config. I didn't look up the format of the config, so I don't know how hard that would be.
Comment | File | Size | Author |
---|---|---|---|
#23 | make_the_simpletest-2134259-23.patch | 2.63 KB | Darren Oh |
Comments
Comment #1
dawehnerThis really helps on some of the more complication test problems! Thank you
Comment #2
tstoecklerExcept that I not only managed to mess up the simplest of patches, but also diverted @dawehner's attention with the substr() thing.
Comment #3
dawehnerHa, but I still trust you.
Comment #4
alexpottThis is brittle. Looking at http://xdebug.org/docs/remote a possible value is
XDEBUG_CONFIG="idekey=session_name remote_host=localhost profiler_enable=1"
and this would totally break this.Comment #5
dawehnerSo, do we really have to pull out the idekey from the string?
Comment #6
tstoecklerHere's a patch that does that. I thought of the possibility of multiple spaces, is there anything else we need to consider? Per your link, @alexpott, I think we're covered:
I didn't yet test this. I suppose we could even write automated tests for this...
Edit: If I end my questions with question marks, people might understand me...
Comment #7
tstoeckler#fail
Comment #8
dawehnerThis worked fine with Drupal\views_ui\Tests\ViewsUITourTest and getting a breakpoint in some actual form. Thank you!
Comment #9
alexpottCommitted 9107f06 and pushed to 8.x. Thanks!
Comment #10
yched CreditAttribution: yched commentedMinor, but would be cleaner to trim just once here:
list($key, $value) = explode('=', trim($pair));
Comment #12
chx CreditAttribution: chx commentedComment #13
Darren OhComment #15
basic CreditAttribution: basic commentedHi there,
#13 was causing the testbot servers to fail, and I had to force a cancel on the test. Please do not re-test the patch above.
Thanks!
Comment #17
tstoecklerComment #18
dawehner@basic
Do you understand why?
Comment #21
basic CreditAttribution: basic commentedI don't know, but the patch was causing issues on the testbots. This could be due to an invalid patch. It could be '+ $request = \Drupal::request();' ? Should that be escaped like it is?
Comment #22
Darren OhThe test was failing because I included some Drupal 8 code in the Drupal 7 patch. There was nothing in the Drupal 8 code that needed to be ported to Drupal 7. The original patch in #6 is fine.
Comment #23
Darren OhComment #24
Darren OhComment #25
tstoecklerPlease don't RTBC your own patch. It looks OK from a cursory glance but the code is slightly different in D7, so someone will have to take a deeper look and also take this for a test run.