T
T
tyraelqp2019-05-14 14:48:36
PHP
tyraelqp, 2019-05-14 14:48:36

How to connect PhpStorm and PHPUnit in Docker?

Good afternoon.
Problem with running tests directly from PhpStorm.
There are 3 Docker containers:

  1. prefix-php-fpm
  2. prefix-mysql
  3. prefix-mysql-test

If you connect to the prefix-php-fpm container via docker-compose exec prefix-php-fpm bash and run the tests, everything runs without problems, no errors or exceptions.
But if you run tests directly from PhpStorma, then on many tests it crashes
Doctrine\DBAL\Driver\PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
.
What could be the reason and what needs to be adjusted to make it work?
6P5rX.pngUWZJZ.pngt9vl1.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GTRxShock, 2019-05-14
@GTRxShock

in bookmarks I found a guide on which I set it up, everything took off
https://blog.alejandrocelaya.com/2017/02/01/run-ph...
although I see that your problem seems to be deeper
ps maybe you need to tweak the application settings or phpunit .xml
https://stackoverflow.com/questions/41913471/docke...

C
chupasaurus, 2019-05-15
@chupasaurus

Basically, you're just running the container outside of the environment that Docker Compose creates.
Support added in 2019.1, but bugs are still coming out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question