Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kovbo's avatar
Level 1

Redis connection issue in test environment

Hi, I'm getting a Redis connection error during PHPUnit tests execution:

Predis\Connection\ConnectionException : php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://redis:6379]

Redis runs as a Docker container and it works fine in a browser or via tinker.

I run tests in PHPStorm using Docker's PHP as an interpreter.

Do you have any ideas?

0 likes
2 replies
tykus's avatar

Do you really need Redis in your tests; can't you use the array cache driver instead?

tisuchi's avatar

@kovbo Make sure that you have set up redis required variables perfectly in .env file. It seems a configuration issue.

BTW, I agree with @tykus comment. Why do we need redis for testing?

Please or to participate in this conversation.