Debugging phpunit code on a remote server

I cant seem to find a way to run my phpunit code though xdebug and debug it in PHPStorm.  It seems that the command line stuff all tries to run on my local machine (the code is on a shared drive, so it appears local on my laptop, a Mac).  Is there a way to run a command line scriptlike

php phpunit.php test/base/test1.php

from the editor and be able to set break points?

1 comment
Comment actions Permalink

Hi Ken,

To execute (and debug) PHPUnit tests with PhpStorm integration on Local computer -- create an entry of "PHPUnit" type in "Run | Edit Configurations..." and then use Run or Debug buttons accordingly.

To do the same on Remote computer, create an entry of "PHPUnit on Server" type. All tests will be done via browser using custom helper file (which means that the Deployment entry must be properly configured).


If integration is not required .. or PHPUnit tests must be run on remote machine from command line .. and you want to debug it then please check these links:


Other useful links that may come handy for remote debugging:


P.S.
It is officially not recommended to keep your project files and work with them directly over network (because of the way how PhpStorm handles files and requires an instant access to them, which can be problematic sometimes because of the network latency etc -- this sometimes causes some weird behaviour, e.g. delays in code completion, sudden random freezes etc) -- the official way is to have local copy of the project and setup automatic deployment to the remote server ((S)FTP(S)/Mounted folder/ Shared folder etc)

P.P.S.

Is there a way to run a command line scriptlike

php phpunit.php test/base/test1.php

from the editor and be able to set break points?

For local execution or remote? Fo local -- yes -- just use "PHP Script" type of Run/Debug Configuration (which still requires you to have debugger configured properly, where PhpStorm knows about all php files involved etc). For remote -- not really as PhpStorm has no built-in SSH client or anything like that, but you can use External Tools functionality for such tasks (will execute your custom shell script that will do whatever you need on remote server .. and if debugger is configured correctly PhpStorm will be able to debug it).

0

Please sign in to leave a comment.