PHPStorm debug test currently open in editor, where the cursor is

Answered

In PHPStorm, there is a hotkey Ctrl + Shift + F10 to "Run context configuration from editor" . It runs a single test where the cursor currently is in the editor. Is there something similar to debug instead of just run? I mean something quick, without touching Run/EditConfiguration etc...

[Update]

Actually, running the test this way doesn't work either. When I compare the automatically created test configuration with my regular test configuration in Run/EditConfiguration, the automatically created test config doesn't have the option "Use alternative configuration file" checked. Without this option, it's just not working. If I manually check this option and specify the phpunit.xml file, then both Run and Debug are working (although, as I said earlier, you need to Run first, because there is no hotkey for Debug).

[Update 2]

The problem of not having the default config file set automatically can be resolved by specifying the config file in Run/EditConfiguration defaults settings. So this issue is kind of resolved, although it still would be nice to be able to Debug directly from a hotkey, instead of Running first.

0
5 comments

Thanks for posting the update!

Regarding Debug from a hotkey: is Shift+F9 not working in your scenario?

0

Shift+F9 is debugging the test which is currently selected in top right corner of the UI in "Select Run/Debug configuration" combo box.

Shift+Ctrl+F10 on the other hand is first creating a test config based on where my cursor is in the editor so the new config becomes visible in the "Select Run/Debug configuration" combo box (first step), and then Running this test (second step). There is no hotkey to create the test config (first step as before) and then Debug it instead of Run.

0

Could you please find "Debug context configuration" in Keymap? By default it lacks a shortcut so you would need to assign one (i.e. Alt+Shift+F11). Looks like that's what you're looking for.

1

That's it, thanks a lot!

0

You're welcome! :)

0

Please sign in to leave a comment.