I configured PhpStorm according to this tutorial: PHPUnit for PhpStorm
I can run my PHPUnit test successfully, so this is working.
The problem is, in my docker container I have enabled Xdebug which I need sometimes. Normally, I docker exec
into the container and run the tests there. Xdebug slows down the tests heavily, so I do phpdismod -s cli xdebug
before I run my tests. Then the tests run 100x faster!
Now I want to achieve the same behaviour when I run the tests through PhpStorm. PhpStorm brings up an own docker container where it runs the tests. I don't know how I can tell PhpStorm to run phpdismod -s cli xdebug
before starting PHPUnit. Is there a way of doing that?
According to the link you mentioned, there is a way to set image name like shlink_shlink_php:latest
for example.
What you need to do is to add entrypoint.sh
in your own image and based on envrionment variable you may enable or disable the debugging mode for example:
export DEBUG="${DEBUG:-on}"
if [ "$DEBUG" == "off" ]; then
phpdismod -s cli xdebug
fi
So by default the debug value is on
which means to leave the xdebug mode active. however if you passed an environment value called DEBUG
with value off
then it will disable xdebug.
You can pass environment variables as explained in here .
Alternatively, you may check the following options which mentioned in here for example try to pass -dxdebug.remote_enable=0
through php additional options from PHPStorm (I am not sure if preventing connection to remote interpreter will be the same as disabling the debugger as i am not expert in this part but you may check it too )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.