PhpStorm 7.1.3 - Is there a way to have the debugger run when running PHPUnit tests?

I inherited a Symfony2 project, and I really need Xdebug to run when running my new PHPUnit tests so I can trace values as the tests are running.  Is this possible?  And if so, how?


Hi there,

So .. what kind of problem you are having with debugging PHPUnit test?

Have you tried clicking "Debug" button instead of "Run" when executing PHPUnit tests from PhpStorm?

If you have PHPUnit tests working .. and you can debug normal php scripts already .. then debugging PHPUnit tests should work with no additional config.


Hmm, it looks like it is working, but not the way I anticipated.  I'm running Symfony2 functional tests, using its client ( to access certain controller methods in my project.  The breakpoints I placed within those methods aren't being recognized, but if I place a breakpoint within my tests, it works.

I think my problem is that the Symfony2 client is firing a new request which isn't being picked up by Xdebug.  So, I think I might need to set up a remote debugging session to fire when the tests are run.  I'm not quite sure how to do that, however. :-/


This may help:

1. Configure xdebug to attempt to debug every single request: xdebug.remote_autostart = 1

2. Increase number of simultaneous debug connections from 1 to some another number (e.g. 2 or 3): "Settings | PHP | Debug | Max simultaneous connections"

3. Use "phone handle" icon as described in

4. Now you can use "Run" button instead of "Debug"


I think we're getting closer.  With the settings you gave me, clicking 'Run' has the debugger attempting to debug the /tmp/ide-phpunit.php file, but it's still not attempting to debug my controller method.


I'm not Symfony  2 user and do not know how exactly it works (how it runs those tests).

I would suggest to ask on Symfony 2 user forums/sites how to debug it using xdebug (since there would be much bigger chance to find a person that knows this) regardless of the IDE used. That should give enough info to see how that approach differs from what you have there (maybe some other xdebug specific configuration is required).


But in any case:

1) Can you just step into that file with controller at all?

2) Do you have breakpoints set up there?

3) On what kind of lines? Try on lines as simple as possible (as on some lines xdebug is unable to break due to the way how PHP itself generates it's byte code)

4) What logs are saying?


Turns out that part of the problem was me supplying the incorrect URI for the client to follow.  So, between giving it the correct URI and your Xdebug php.ini tweaks, it's working like a charm now.

Thanks! :)


Please sign in to leave a comment.