Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rikh's avatar
Level 3

Debug phpunit test using PHPStorm and Homestead

I use homestead as my VM and normally ssh in and run PHPUnit.

I also use PHPStorm and use the debugger to track down problems.

However, I've only been able to get this to work when debugging the site from the browser. I've never been able to get PHPStorm to start a debug session when running something on the command line in the VM.

I've got PHPStorm 9 at the moment and have set it up to run the tests on the VM and that is working fine. The Debug Tests also appears to work and runs the tests, but the code never hits any of my breakpoints. I suspect it has something to do with path mappings - the config is suggesting I set up SFTP deployment to set the path mappings, but that just seems plain wrong to me.

Firstly, has anyone managed to debug PHPUnit tests, running on homestead, using PHPStorm? If so, what is the magic needed to make it work?

0 likes
3 replies

Please or to participate in this conversation.