Upgrade your Pest test suite from Pest 2 to the latest version.
composer require rector/rector-pest --devEnable the composer-based Pest set in your config. Each rule is bound to the pestphp/pest version installed in your project, so it is applied only once its target API exists:
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withComposerBased(pest: true);| Rule | Change | Pest |
|---|---|---|
TapToDeferRector |
tap() to defer() in high order tests |
>=2.0 |
ExpectObjectToHaveMethodToClassRector |
object to class name in toHaveMethod()/toHaveMethods() |
>=3.0 |
ThemeToPrinterRector |
pest()->theme() to pest()->printer() |
>=3.0.3 |
UsesCompactToPrinterCompactRector |
deprecated uses()->compact() to pest()->printer()->compact() |
>=3.0.3 |
RemoveCoversNothingRector |
remove ->coversNothing(), dropped with PHPUnit 12 |
>=4.0 |
Pest 5 has no code-level changes, only dependency and PHPUnit 13 updates.
The /blueprint directory contains the Pest upgrade guide and Pest release notes from 2.x onwards, used as the source for these rules.