Running PHPUnit Tests in PhpStorm with Docker

preview_player
Показать описание
It's the next video in a series about the usage of PHPUnit and various interpreters in PhpStorm. Here Gary Hockin, PhpStorm Developer Advocate, explains how to run PHPUnit Tests in PhpStorm with Docker.

Related videos:

Category: Testing
Рекомендации по теме
Комментарии
Автор

Awesome, that is example how tutorials should be like - you follow and it works.

darius
Автор

Awesome tutorial for the setup! Thanks for sharing.

eamirgh
Автор

Should we keep the default value `/opt/project` even if our project is located in `/var/www/html`?
If so, why are we able to edit it?

richardcarree
Автор

I followed all the steps. In the - Languages & Frameworks > PHP > Test Frameworks - I added Interpreter: Docker PHP 7. But under "Path to Script" I get message "PHPUnit Version: Not installed". On command line unit test works fine. And in PHPUNit Console I get this message - The value of autoloader is specified, but file doesn't exist Any suggestion to fix this.

SunilSharma-moyz
Автор

I would like to see this revisted with WordPress and PHPUnit tests as I have it connecting OK. Finding the root address from /app/wordpress to /opt/project/wordpress through me but now I cannot get the MySQL to connect so I can't run any tests

MrWilde
Автор

PHPStorm always does a "docker-compose up" even when the containers are already running. I have a container each for PHP and nginx; PHPStorm kills the PHP container, starts the PHP container and kills it again after PHPUnit has finished. The tests get executed okay, but now my manual test environment (i.e. using a browser) doesn't work because only the nginx container is running. Is there a neat way to avoid this? I suppose I could create a copy of the PHP container that is exclusively for PHPUnit but then I have two PHP containers to maintain and keep in sync. That is not ideal.

donconore
Автор

This works for local mysql setup. However if mysql is inside a docker container - I can't make this setup to work. Getting `connected timed out` when connecting to remote mysql on test execution attempt. And I believe all the values are right - as my app itself is working and spent a decent amount of time debugging without luck...

MrGoldbergification
Автор

Thanks for tutorial, but how we can configure coverage and show coverage data in phpstorm?

suldrdd
Автор

Button of Run doesn't work. Beacause the directory of file is empty. It's doesn't work here with IntelliJ IDE 2019.3.4

riosrios
Автор

In our company we use Docker inside of Vagrant (using an Ubuntu image) because our developers have different operating systems. Is there also a solution to run PHPUnit in PhpStorm with our particular setup?

decline
Автор

it's works,

but in tests that have connection to database i got this error

SQLSTATE[08006] [7] could not translate host name "postgres" to address: Name or service not known

Note that everything goes fine on php execution, but in PHPUnit tests i got this message

MohamedFathifati
Автор

you cannot access a database container inside a test, any idea how to fix this?

SupunPraneeth
Автор

Is there any Windows 10 + phpstorm + docker tut. video?

ElTebe
welcome to shbcf.ru