Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Phpstorm and other IDEs allows you to run behat tests in debug mode.
But when it executes "Then I break" step it is not possible to press "enter" continue.
So "Then I break" step works only if you run tests using terminal.
But sometimes it is very useful to stop the process with "Then I break" and have a look into the browser during debugging.
Would be useful to set xdebug_breakpoint in "Then I break" if xdedug is enabled.
Comment | File | Size | Author |
---|---|---|---|
#3 | behat_drupal_xdebug_break-2377427.patch | 1.01 KB | a.milkovsky |
Comments
Comment #1
a.milkovskySee the attached patch
Comment #2
fagoI love the idea, however looks like xdebug_is_enabled() does not check for the right thing:
>Return whether stack traces would be shown in case of an error or not.
Maybe there is an alternative function which tells us whether xdebug is in debug mode?
Comment #3
a.milkovskyI think function description might be misleading. (See http://xdebug.org/docs/all_functions)
xdebug_enable() - Enables stack traces. Enable showing stack traces on error conditions.
xdebug_is_enabled() - Returns whether stack traces are enabled. Return whether stack traces would be shown in case of an error or not.
I changed a little bit patch to detect if current output is terminal.
Comment #4
derickr CreditAttribution: derickr commentedYou should be able to call xdebug_break() even when Xdebug isn't running though, but you're right that xdebug_is_enabled() doesn't work here. I would need to add an argument to xdebug_is_enabled() so that you can request whether specific features are turned on. Please file a feature request at http://bugs.xdebug.org if you want!
Comment #5
a.milkovsky@derickr, thank you for your comment. I agree that it is not so easy with xdebug_is_enabled().
You can see my last patch. I detect terminal and xdebug separately. For xdebug xdebug_break() function is called. If xdebug is not started, the function will be just ignored.
Comment #6
fagoRelated: Very useful for debugging is https://github.com/DevinciHQ/devinci-behat-extension.