phpunit debugging only going into phpunit.phar file

546 views Asked by At

I’m attempting to debug unit tests using XDebug through PHPStorm.

The tests run on the server correctly. When I turn on debugging in PHPStorm and have remote debugging enabled on the server, PHPStorm will open up the phpunit file and tell me that is the line it is on. If I click continue, it never reaches the breakpoint I have in my unit test; which I’m 100% positive is being hit.

I have added the following to my: /etc/php5/cli/php.ini

xdebug.remote_enable=1
xdebug.remote_port=9020
xdebug.idekey=PHPSTORM
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.extend_info=1
xdebug.show_local_vars=1
xdebug.remote_host=x.x.x.x

I run the test with this:

function debugTest() {
   php -d xdebug.remote_enable=1 `which phpunit` `pwd`/$1
}

$ debugTest myclassTest.php

Honestly, I’m not sure what to share from my PHPStorm setup that would be helpful, but if anything would be helpful, I can send it along.

1

There are 1 answers

0
FlorIT On

There are several ways to improve the test execution:

  • Use the 'PHPUnit' or 'PHPUnit on Server' debug configuration in case of a virtual machine dev setup
  • Use debug over SSH
  • extract PHPUnit files in a local directory

What was your solution?