Home > Blockchain >  How to run PHPUnit test inside a running container
How to run PHPUnit test inside a running container

Time:08-29

I use PhpStorm in development. To run a test I do below 3 commands:

docker-compose exec app bash
cd app/
vendor/bin/phpunit unitTest/Sample.php 

I want to be able to run the test just by clicking the "Run" button inside PhpStorm.

I tried to accomplish it using docs from IntelliJ but they overwhelmed me. I thought I just need to change the interpreter path but couldn't understand how to attach to a running docker.

CodePudding user response:

First you need to add your Docker-compose based interpreter. See php interpreter Second, add a PHPUnit configuration based on this interpreter, see phpunit config After that you should be able to simply Run the tests using IDE UI.

  • Related