Unit & integration tests in PHPStorm

This guideline is about how to configure PHPStorm to run unit & integration tests locally.

Requirements

  • docker-compose (>= 1.21)
  • docker (>= 18.06)
  • PHPStorm (>= 2018.1)

Setup

  1. Enter settings: File → Settings → Build, Execution, Deployment → Docker
../../_images/tests_1.png
  1. File → Settings → Languages & Frameworks → PHP
  1. Configure CLI Interpreter
../../_images/tests_2.png
  1. Configure PHP settings
../../_images/tests_3.png
  1. File → Settings → Languages & Frameworks → PHP → Test Frameworks and then configure PHPUnit by adding Remote Interpreter
../../_images/tests_4.png
  1. Run/Debug Configuration
../../_images/tests_5.png

Now you are able to execute all tests via IDE using green Play button or Run menu.