Closed zaifastafa closed 4 years ago
Are you running that command inside the container or outside?
I have on my machine a host entry for "mysql" to 127.0.0.1
Do I have to create that entry? I have setup a remote interpreter in Phpstorm for the unit tests. This is the command that gets executed:
[docker-compose://[/tmp/swdc-docker-compose.yml]:app_shopware52/]:php /var/www/html/vendor/phpunit/phpunit/phpunit
Hi @shyim any update on this? Have you setup remote interpreter with PhpUnit in PhpStorm with this setup?
I don't use those features 🙈
Hey @zaifastafa , I'm using this setup with the PhpStorm tools as well, your approach using the docker-compose
interpreter should work. Since your issue seems to be caused by name resolution errors - did you by any chance modify the given container networks, or maybe set a fixed DNS server for your docker daemon (guessing a bit here)? Also, how does the database connection in config.php
look like? The app should be connecting to the mysql
host.
@philipgatzka No I am simply using the default configurations and setup from the repository (except the ~/Code
folder which I changed to my own directory. Apart from that the shop loads and works perfectly fine when I execute the swdc build
and swdc open
commands. I can access everything, the frontend and the backend as well. It is just when using the Phpstorm tools to execute the unit tests do I get this error.
For the sake of being thorough, do you know how can I reset the DNS server for the daemon? I had installed the repository after doing a docker prune
so I dont think there was any conflict with an existing network either.
UPDATE: I have used the default shopware docker setup from the official git repo as well and it always works properly by using the docker-compose
interpreter.
The daemon can be configured like this, but I think I've figured out what the problem is.
docker-compose
creates a new network for the container when it is used without the COMPOSE_PROJECT_NAME
being set (which is the case when we're referencing the swdc file under /tmp). Therefore the container running the tests doesn't know about any of the other containers belonging to the shopware-docker
project. The solution would be to set this environment variable. I tried it, and it works on the CLI, but PhpStorm can't work with that apparently. I'll have to check for another solution later, I'll keep this thread updated if I find something.
@philipgatzka great thanks! Will keep checking here for an update. It really is a great solution for setting up different versions of SW for development, especially in the case of unit and functional tests. Would be even better if we can get the PhpStorm to work with it.
Well, it seems like I misconfigured something on my other machine. I tried it with the COMPOSE_PROJECT_NAME
variable and a fresh setup now and it works as intended :slightly_smiling_face:
This is a screenshot of my interpreter configuration:
(Edit): And the test runner config:
Does this work for you?
Hi @philipgatzka thanks I will check it out and update here asap.
UPDATE: Thanks! It works. The env
variable was missing in my previous setup.
Love the comprehensive way to create different environments for testing with a single docker installation. However, I wanted to ask how do make the connection of docker with Phpstorm especially to execute unit tests. By using the regular docker installation from the shopware git repository, I am able to execute it properly. But in here, it gives this error. I am using
I have tried both these approaches: http://i.imgur.com/Yllk0de.png and http://i.imgur.com/6cHkr4F.png
Any idea about that? Thanks.