![phpunit phpstorm phpunit phpstorm](https://i.stack.imgur.com/sRIK5.png)
Okay, let’s see ALL the steps that I go through to set this up. If all XDebug options are displayed with their default/configured values, it works! Start configuring! To know whether XDebug is available, run php -dzend_extension=xdebug -i | grep xdebug. Yeah, it’s just about removing the extension. TL DR: it means that you can do php -dzend_extension=xdebug instead of php -dzend_extension=xdebug.so for UNIX and php -dzend_extension=xdebug.dll for Windows. If you have PHP 7.2+, you can even make your debug-based test scripts cross-compatible with any platform thanks to extension loading by name This echo thing is a trick to force pecl to execute in a “non-interactive” mode, in order to let the Docker image be built automatically with no user interaction (which is not possible).
#Phpunit phpstorm install
I usually install it in my Docker images by adding a RUN statement with (echo '' | pecl install xdebug). Of course now you have a working Docker setup, but remember that XDebug must be present. I also consider you already installed the Docker plugin for your PHPStorm IDE. I will now consider you have a working PHP + Docker environment. Having a working Docker environmentįirst of all, if we talk about Docker, you may refer to the series of blog posts I wrote about Docker, it might help you. I’m only using it when testing, with PHPUnit or Behat, and that’s perfect: it forces me to write more tests.
![phpunit phpstorm phpunit phpstorm](https://cache.yisu.com/upload/information/20200310/52/109056.jpg)
I have struggled so much in the past and never succeeded in configuring this, and I will probably never do it anyway. ℹ️ Important note: I will not talk about using it in an HTTP context. Here, I’m going to talk about configuring XDebug with PHPStorm and Docker.