Member-only story
Laravel 8.0 with Pest testing framework
“Pest is a Testing Framework with a focus on simplicity. It was carefully crafted to bring the joy of testing to PHP.” — Pest Website. It plays nicely with PHPUnit, complementing it rather than compete with it.

A quick overview of what this article will cover. I will be documenting the following topics, this is mostly a setup walk-through rather than an in-depth guide about how to use Pest.
- Installing Pest in Laravel
- Using Pest
- Setting up PHPStorm
- Setting up PHPStorm with Xdebug
Installing Pest
Before you start, this assumes you already have composer and PHP 7.3+ installed on your development environment.
Install Pest via Composer with,
$ composer require pestphp/pest --dev --with-all-dependencies
Next, install a plugin for Laravel.
$ composer require pestphp/pest-plugin-laravel --dev$ php artisan pest:install// if you are on sail
$ sail artisan pest:install
If everything is working, try it out with
$ php artisan test// if you are on sail
$ sail artisan test
Using Pest
I think it would be clearer if you went through the excellently written documentation on their website.
To keep things simple, we’ll just create one test each in the “Unit” folder and the “Feature” folder nested within the “tests”.
it('asserts true is true', function () { $this->assertTrue(true); expect(true)->toBeTrue();});
We can use either the test()
or it()
functions to describe and provide closures to assert our test cases. Please read the documentation for more details.
An important point to note is that all PHPUnit ways tests are still valid. You can continue to write PHPUnit-styled tests and this is still fully compatible.