Debugging PHPUnit test on vagrant VM

I am using PHPStorm on a mac, with a vagrant VM installed (PHP 5.6, XDebug 2.2.5) XDebug .

My code folders are shared with the VM and I can ssh into the VM and run PHPUnit to run all my tests.
I have also set up PHPStorm 9 EAP and have it running the tests on the VM from inside the IDE.

However, when I choose to Debug Unit Tests, it runs all the tests like normal, but will never stop on any breakpoints I have set. I don't get any errors reported - it just never stops in the debugger.

Has anyone got this working? How?

The debugger works fine when manually using my app in the browser.

5 comments
Comment actions Permalink

Hi there,

Go trough these articles first in case you have not seen them yet:


Possible reasons:

  • wrong IP:port
  • path mappings


In any case: please collect xdebug logs for such unsuccessful debug session (and sucessfull via browser as well): http://xdebug.org/docs/all_settings#remote_log

0
Comment actions Permalink

Got it working.

PHPStorm was telling me I had to set up an SFTP config to make the folder mapping work. I did this, despite it making no sense, and it worked. Yay!

0
Comment actions Permalink

It could be because it cannot figure out / interpret your vagrant mappings (for whatever reason). It needs something to work with (to map local files to remote) and when working with remote interpreters over SSH, the SFTP deployment provides enough info.

Sure, it's not ideal, but such workaround (if we can call it that way) should be not a big deal for user to do.

0
Comment actions Permalink

It's possible.

I'm using Homestead ( http://laravel.com/docs/5.1/homestead ) which does not list the mappings inside the VagrantFile like normal and has them in a separate yaml file.

1
Comment actions Permalink

I'm not a Vagrant user myself .. so don't know much in this area (don't really follow such issues etc)

If you wish -- I may only suggest to submit a ticket to the Issue Tracker with details of your setup (vagrant file/instructions/whatever is is required) so that devs may have a look into it (if it's a PhpStorm issue or what not). As far as I'm concerned such popular setup (I mean -- Homestead) should ideally be supported with no additional moves. But please check if such ticket does not exist already.

0

Please sign in to leave a comment.