Reputation: 1283
I have the Vagrant box with several containers and one container is for PHP engine.
Usually, I run my tests inside Vagrant box like:
docker run <my_specific_parameteres> remote.docker.container.php7.2 bin/phpunit --coverage-clover -c phpunit.xml.dist
But, I want to run this with PhpStorm. It is possible? If yes, any help, because I do not know how to properly configure my PhpStorm to run PHPUnit as I want.
Upvotes: 2
Views: 923
Reputation: 3043
It's a bit complicated because there is one extra virtualization layer (host => Vagrant VM => Docker), but it's possible.
Let's agree on these:
/home/PhpstormProjects/theProject
is the path of your sources on the host./var/www/html/theProject
is the Vagrant VM path your sources are mapped into./opt/theProject
is the container path the Vagrant path is bound to with volume mappings.First, you need to configure your Docker daemon to listen on TCP port: https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd
Then, you need to add these Docker server at PhpStorm Settings | Build, Execution, Deployment | Docker
.
After that, add a Docker remote interpreter using the desired image at PhpStorm Settings | Languages & Frameworks | PHP
.
You need to set the following mappings later:
/opt/theProject
/var/www/html/theProject
/home/PhpstormProjects/theProject
/opt/theProject
After that, configure PHPUnit for this Docker interpreter at Settings | Languages & Frameworks | PHP | Test Frameworks
, it should be able to parse paths OK.
That's basically it, you should be good to go. Unfortunately, there's no option to pass custom arguments to Docker: https://youtrack.jetbrains.com/issue/IDEA-181088
If there are any issues, please submit a support request: https://intellij-support.jetbrains.com/hc/en-us
Upvotes: 4