In this lesson, we will look into migrating our PHPUnit tests to Pest which is growing in popularity. It can be done in two ways:
- Manual
- Semi-Automated
Manual Migration
Manual migrations can be huge but Pest is designed to make it as easy as possible. It can run a combination of tests - PHPUnit and Pest automatically. This means that you can migrate your tests one by one, or all at once.
Just follow the installation instructions and start writing new tests in Pest!
Semi-Automatic Migration
Semi-automatic migrations can be done using Laravel Shift. It doesn't cost that much (at the time of writing, $9 to convert one repository) and provides a Pull Request with the changes:
It also adds quite a few comments to your tests to help you understand what's going on:
We've tried to use Shift for this course and let's look at what it gave us.
Notice: I want you to understand correctly: you don't have to use Shift as we did, it's totally fine if you decide to perform the following changes yourself manually, for free.
Preparations
The first thing Shift did was prepared our codebase for Pest:
- It added the
pestphp/pest
package to...