katedev4 Jul 2025 18:42

Team switched from PHPUnit to Pest 6 months ago on a new Laravel 11 project. Documenting what changed and whether we would make the same choice.

Replies (6)
alex_petrov4 Jul 2025 18:51

Pest tests read significantly better for feature tests. The it() and describe() structure maps well to user stories. Unit tests are less different from PHPUnit style.

0
ivan_morozov4 Jul 2025 19:40

The dataset feature (data providers) is much cleaner in Pest than PHPUnit data providers. No static methods, no associative arrays, just ->with([]).

0
katedev4 Jul 2025 21:20

Higher order tests and expectations are great for asserting on collections. $this->assertCount() vs ->count() is a readability improvement. Also the failure messages are better formatted.

0
nphp4 Jul 2025 21:24

PHPUnit compatibility layer means Pest runs PHPUnit tests without changes. Migration is gradual: new tests in Pest, keep old PHPUnit tests as-is until you have time to convert them.

0
vova4 Jul 2025 21:42

One downside: IDE support was weaker 6 months ago. PHPStorm now has better Pest support but some completion features still lag behind PHPUnit. Minor issue but worth knowing.

0
sergey_web4 Jul 2025 22:10

The arch() test feature in Pest is genuinely useful: assert that controllers do not depend on repositories directly, that models do not have HTTP-specific code, etc. Enforces architecture constraints in CI.

0
Write a reply
Markdown. ```php blocks are runnable.