LaravelPestTestTestingWeb Development

Apr 13, 2023

How to run Pest tests along PHPstorm and Laravel Sail

By Vladimir Nikolic, CEO Coding Wisely

How to run Pest tests along PHPstorm and Laravel Sail

I am thrilled to be using Pest for PHP testing! The syntax is incredibly readable and expressive, which makes writing and maintaining tests a joy. I love how Pest's conversational style feels more like a natural language than a coding language, making it so easy to understand what each test is doing. The additional features, such as test parallelization and coverage reports, are a huge bonus that help me to be more productive and confident in my work. Overall, Pest has transformed my testing experience and made me a very happy developer!

This article documents the process of using Laravel Sail for local development, and provides instructions on configuring PhpStorm to work smoothly with Sail and tests with Pest.

With every project i struggle to remember what has to be done, so decided to put it in article.

To install the Pest plugin in PhpStorm, follow these steps:

Open PhpStorm and go to the "Settings/Preferences" menu by clicking on the gear icon in the bottom left corner of the window.

In the settings menu, select "Plugins" from the left-hand sidebar.

In the Plugins menu, click the "Marketplace" tab at the top of the window.

Search for "Pest" in the search bar at the top of the window.

Click the "Install" button next to the Pest plugin.

Once the installation is complete, click the "Restart IDE" button to restart PhpStorm and activate the Pest plugin.

After restarting PhpStorm, you can start using Pest in your PHP projects.

Note: Pest requires PHP 7.4 or later, so make sure you have the appropriate version installed before using the plugin.

Sail is a tool that enables the use of Docker without having to deal with Docker commands directly. It relies on an image that includes the latest versions of PHP, Nginx, and MySQL. Sail is a Laravel package, which means it can be used with either a new Laravel installation or an existing project.

To use Sail, you need to have Docker installed on your machine. If you don't already have it, you can download it from https://www.docker.com/. You also need to have PHP installed to run Composer and install Sail on existing projects.

To configure PhpStorm to use Docker, open the settings and select "PHP" -> "Test Frameworks." Click the plus sign to add a remote connection and select the Sail container, then select "Docker" and the Sail image. This tells PhpStorm to use Docker for CLI actions.

Select configuration type
Next, make sure that proper test framework is selected:
Type in your terminal: ```docker network ls```

Remember the network:

Click on folder icon to pop next window and enter the network mode, in my case agri4all_sail.

That should do it, right click on file and select run test, and you will get results:
or run only one method with right click directly in file.

Other posts:

Laravel.rs Meetup #1: A New Era for the Serbian Laravel Community
Laravel
Laravel.rs Meetup #1: A New Era for the Serbian Laravel Community

On May 10th, 2025, Laravel.rs officially launched its first-ever meetup in Temerin, bringing together developers from across Serbia for a night of lightning talks, community networking, and a shared love for Laravel. With inspiring talks, open discussions, and future plans for workshops and hackathons, this kickoff event marked the beginning of a vibrant new chapter for Laravel in Serbia. 🚀🇷🇸

Vladimir NikolicVladimir Nikolic
May 15, 2025
Code, Stress, and Recovery: My Path to a Healthier Developer Life
Tips and Tricks
Code, Stress, and Recovery: My Path to a Healthier Developer Life

For years, I ignored the signs of burnout—long hours, constant stress, and the fear of failure. It caught up with me. I landed in the emergency room. This is my story of hitting rock bottom and rebuilding my health, mindset, and career.

Vladimir NikolicVladimir Nikolic
Feb 28, 2025
How to use git hooks to run scripts before the committing code to repo
LaravelTips and Tricks
How to use git hooks to run scripts before the committing code to repo

Make sure that all and everything you want to run before the pushing code to production, works as you expect. Simply use git hooks.

Vladimir NikolicVladimir Nikolic
Feb 15, 2024

Are you set to create something extraordinary?

Ready to take the next step? Let's work together to transform your ideas into reality. Contact us today to discuss how we can help you create impactful, user-centered solutions that drive success.

Contact Us