How to use PHPUnit on Docker in PHPStorm

Backend May 10, 2020

PHPStorm Version: 2019.3.4

Specify CLI interpreter

Go to Settings > Languages & Frameworks > PHP
Screenshot-from-2020-05-10-21-56-02
Select a interpreter from Docker
The result looks like this
Screenshot-from-2020-05-10-21-54-39

Add testing framework configuration

Go to Settings > Languages & Frameworks > PHP > Test Frameworks
Select Configuration Type: PHPUnit by remote interpreter
Select the interpreter configured previously
Screenshot-from-2020-05-10-21-58-43
The final result looks like this
Screenshot-from-2020-05-10-21-59-19

Try it

Then you can see the test, try to run it.
Screenshot-from-2020-05-10-22-07-17

Tags

Sophie Cao

(she/they, elle/iel, 她/佢)