rector/rector-phpunit
Rector rules for PHPUnit that automate test suite upgrades. Modernize assertions, replace deprecated APIs, and keep tests compatible across PHPUnit versions through automated, configurable refactoring—no manual edits required.
@dataProvider → #[DataProvider], setUp(): void, removed/changed assertions, prophecy and mock-builder deprecations). It directly informs when we can commit to PHPUnit 10/11/12 and, by extension, which PHP versions and Laravel releases we can track.rectorphp org, and sits on a tool (Rector) we may already run for production code. Decision: adopt the rule set rather than fund bespoke codemods.Adopt when:
TestCase subclasses, limited custom base classes, few dynamic mock patterns) so rules match cleanly.Look elsewhere or skip when:
For executives: This is a free, MIT-licensed automation add-on for a code-modernization tool we may already use. It converts what is normally a slow, error-prone PHPUnit upgrade into a reviewed pull request — reducing the engineering cost of staying on supported, secure PHP and Laravel versions. Cost is essentially zero (a dev-only dependency); the return is measured in upgrade days avoided and delayed security patches eliminated. It is infrastructure, not a product feature: expect no customer-visible change.
For engineering: It's the PHPUnit rule set for Rector — dry-run first, review the diff, then apply. It handles the tedious 80% of a PHPUnit 8/9 → 10/11 migration (annotations to attributes, signature and assertion changes) and leaves the judgment calls to us. Caveats: it's a small project (117 stars, no listed dependents) so we pin the version, keep the changes in a dedicated PR, and audit anything touching mocks or custom assertions. Budget roughly one engineer-day to pilot on the largest test directory and produce a scoped diff; that pilot is the go/no-go gate, not a full commitment.
How can I help you explore Laravel packages today?