EspiritoEspirito Logo

PestPHP 5 Quietly Changes the Testing Game

PestPHP 5 Quietly Changes the Testing Game

Just like clockwork, on stage at Laracon US 2026, Nuno Maduro announced the next major release of Pest. But if you only read the release notes, this new version might seem underwhelming — especially in comparison to the big headline feature of Browser Testing in Pest 4.

But taking a deeper look, PestPHP 5 starts to address three fundamental questions that, until now, we’ve accepted as limitations when writing tests in PHP. And by answering them, it quietly brings us closer to an optimal testing future.

1. How Do We Test AI Outputs?

​It seems like today we’re chucking everything but the kitchen sink at AI models. And with them forming a core part of our workflows, testing software is more important than ever. But including AI-powered features in our application provides a unique challenge:

How can we ensure quality, correctness and dependability in AI outputs when they’re non-deterministic by nature?
Vector artwork of a humanoid AI delivering a speech, with the shadow showing a long, pointed nose.
AI gets things wrong all the time. And if we’re integrating AI-powered features into our platform, we need a way to test it’s actually doing it job. (Image: Flash Vector/Shutterstock.com)

That’s where Pest Evals come in. Instead of strict matching, Evals spins up other AI models to evaluate the quality of outputs — much like a human would, except available in your CI/CD pipeline. It makes both feature and regression tests easier to write for AI outputs, in-turn letting you evaluate whether updates to a model still output with adequate quality.

2. Is The Code Wrong, Or The Test?

​We’ve all been there: you run your test suite, something fails, but you’re not quite sure why. Fast-forward an embarrassing amount of time and you realise you typo’d $this->comm as $this->comn in your test function. It wasn’t your code logic nor your test assertions, but a mistake in the structure of the test itself.

Errors manifest themselves in all sorts of ways. And the more tools we have to detect them, the better. (Image: Greg Muccerino/Shutterstock.com)

These kinds of bugs are the reason tools like PHPStan exist. But they’ve always struggled in Pest due to its magic and dynamism. Just the sheer number of false positives made it tough to justify; even the Laravel Starter Kits have disabled PHPStan in the tests directory by default.

But that all changes with the official PHPStan plugin. It include Pest-aware rules for PHPStan to cover all of Pest’s magic, letting it find issues in your tests while crucially removing the false-positive noise. It further detects illogical tests, or ones that will never pass, helping to find issues you otherwise wouldn’t.

3. Can We Only Run Relevant Tests?

​For some, running a test suite is a chance to get up from your desk, have a stretch and gives you eyes a break. But as your suite approaches the size of Mercury, each run can take tens of minutes. So we try --filter or ->only() our way to faster runs, but that comes with a tedious setup and the risk of missing tests.

To solve this issue, PestPHP ships with a new engine: Test Impact Analysis, or Tia for short. Tia takes a smarter approach to deciding which tests to run:

  • On your first --tia run, it records which tests call which code.
  • On subsequence --tia runs, only those which test changed code are re-run.
Person with clock face holding vintage telephone in eclectic room setting.
Large suites take time to run. And narrowing on running just the tests you want isn’t always easy. Until now, with the Tia engine. (Image: Photo by Tima Miroshnichenko)

So as you fix a bug, refactor a function or take a chainsaw to your architecture, Pest will know which tests are actually worth re-running. This does two critical thing:

  1. ​Saves you a boat-load of time. With Tia, you can do a single discovery run at the beginning of your session to make all subsequent suite runs so much faster.
  2. It stops you missing tests. Finding which tests to re-run after changes is a perpetual issue. Tia knows how to find them, and will automatically re-run all tests required.

Honourable Mentions

In addition to these changes, PestPHP 5 brings other new features that are worth a mention:

  1. The agent plugin lets AI agents run ad-hoc tests instead of relying on whacky CLI workarounds, saving tokens and improving consistency.
  2. ​Time-Based sharding makes CI runs faster by distributing tests by execution time instead of quantity.
  3. Automated refactoring with Reactor gives your test suite a free upgrade, letting benefit by running a single command.

Pest 5 Silently Changes the Game

Without any one headlining feature, PestPHP 5 instead focuses on the fundamentals: making writing, executing and maintaining your test suite the best it can be for PHP developers. And by continually focusing on packing innovative features and improving the developer experience, it’s quietly changing the testing game. And with breaking changes limited to those in PHP 8.4 and PHPUnit 13, whether you’re still writing tests yourself or reviewing those from coding agents, the PestPHP 5 upgrade is a no-brainer.

Testing is critical to high-quality software, but it’s often the first thing cut due to time or budget constraints. Our mission at FONSEKA is to craft software that lasts, and that means continually improving our products — with automated testing a key part of that. For a complete service, including meaningful testing, chat to us today!

Post Details

Author: Lachlan Rehder

Categories:

Updated: 14 Aug 2026

Interested in one of our products?

Get in touch and let us know how we can help! 😇