I configured PhpStorm to run PHPUnit tests from Docker container. Unfortunately if test tries to connect to MySQL server I get an error:
SQLSTATE[HY000] [2002] Connection refused
MySQL server runs in the same container. If I try to connect to MySQL server from container via some standalone script - it works fine. Also the app itself works fine too.
Other tests (without database usage) work fine.
Any ideas what is wrong with my PhpStorm configuration? I followed official step by step configuration video tutorial, but it does not cover database part.
PhpStorm runs command that is being executed every time I hit run tests button:
docker://mycontainer/myapp:v1.0/php /opt/.phpstorm_helpers/phpunit.php --configuration /var/www/myapp/tests/phpunit.xml /var/www/myapp/tests/unit
Maybe problem is with phpstorm_helpers? Because it stands as separate container. Maybe my app container and helper container should be linked somehow?