1 min read

PHPUnit with Laravel Sail

Jetbrains IDE PHPStorm

Configuring your IDE for development is always a long road, you find the roadbumbs along the way. Below we explain how to setup the CLI Interpreters to run PHPUnit with Sail in the Docker environment.

How to configure PHP Interpreter to work with Laravel Sail

If you configure this correctly, you can make use of all the best features your IDE has to offer.  

First, bring up the settings screen, easily by pressing

ctrl + alt + s

Search for CLI Interpreters and do the following

CLI Interpreters for Laravel Sail with Docker

Make sure the CLI Interpreter you just created, is selected as the default interpreter for this project as the image below shows.

Thats it!

If you now run a PHPUnit Test, it will run in the Docker Environment. If you also want to enable xDebug, that is easily available with Sail, add the following to the .env file.

// .env
SAIL_XDEBUG_MODE=develop,debug,coverage