Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for xdebug in WebTestBase #5825

Open
klonos opened this issue Oct 9, 2022 · 1 comment · May be fixed by backdrop/backdrop#4230
Open

Add support for xdebug in WebTestBase #5825

klonos opened this issue Oct 9, 2022 · 1 comment · May be fixed by backdrop/backdrop#4230

Comments

@klonos
Copy link
Member

klonos commented Oct 9, 2022

This is to crossport https://www.drupal.org/node/889338 which was backported from D8 to D7 core back in 2015:

Since simpletest is meant for testing/development, it would be helpful if it fully supported debugging.

As things are now, if you want to debug what happens inside the drupalPost/drupalGet requests in Simpletest [debug in the sense of "step through the code in a debugger", such as xdebug or Zend], you have to do something like what is described on the bottom of this page:
http://drupal.org/node/30011

Namely, you either need to set up a separate Apache virtual server and use that, or you need to hack drupalPost/drupalGet to add something like this near the top to add the debugging session information to the URL before it is passed through curl:

if (!isset($options['query'])) {
  $options['query'] = array();
}
$options['query'] += array('XDEBUG_SESSION_START' => 'ECLIPSE_DPGP');

It would be nice if SimpleTest could do this automatically. ...

PS: noting that there is this D8 -> D7 backport follow-up in d.o: Make the Simpletest XDebug integration work for CLI requests. If we take too long to review/test this, perhaps keep an eye on that other issue and include it here.

@quicksketch
Copy link
Member

I used xdebug all the time with SimpleTests without any special work. But I think ddev might be doing something to make that easier. Checking out the php.ini settings it adds, it sets xdebug.start_with_request=yes, which means xdebug runs on every request. If set to xdebug.start_with_request=trigger, then XDEBUG_SESSION_START is used to start xdebug on a conditional basis. But I think this is all only feasible with ddev because it makes it so easy to turn on/off xdebug:

ddev xdebug on

...run my debugger requests...

ddev xdebug off

It looks like xdebug.start_with_request=trigger is the default when xdebug is in debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants