Skip to content
Programing

Pest 5: Revolutionizing PHP Testing with TIA and AI

Published: Duration: 6:06
0:00 0:00

Transcript

Host: Hey everyone, welcome back to Allur! I’m your host, Alex Chan, and I am so glad you’re joining me today. If you’ve been in the PHP world for more than five minutes, you know that testing has gone from "that thing we probably should do" to "the thing that keeps us from losing our minds on a Friday afternoon." But let’s be honest—traditional testing can feel… well, a bit slow. We’ve all been there, sitting around for ten, fifteen minutes, watching those little green dots crawl across the terminal while we check our emails for the tenth time. Host: Joining me today is Marcus Thorne. Marcus is a Lead Software Architect who’s been a staple in the Laravel and PHP community for years. He’s been an early adopter of Pest since the very beginning and has been deep in the trenches beta-testing Pest 5 on some pretty massive codebases. Marcus, it is so great to have you on Allur! Guest: Thanks so much for having me, Alex! It’s a pleasure to be here. I’ve been vibrating with excitement to finally talk about Pest 5 in public. It’s been a long time coming. Host: I bet! I mean, every time Nuno and the team drop a major version, the community goes wild, but this feels different. Before we get into the AI stuff—which I know everyone is curious about—we have to talk about the Tia Engine. "Test Impact Analysis" sounds like a very "enterprise" term, but what does it actually mean for the developer sitting at their desk? Guest: [Laughs] Yeah, it does sound a bit formal, doesn't it? But honestly, the "aha moment" for me was when I realized I could stop being punished for having a large test suite. Look, we all want 100% coverage, right? But as your app grows, your test suite grows. Eventually, you change one line in a Controller, and you have to run 2,000 tests just to be sure. It kills your flow. The Tia Engine basically uses Git to look at what you *actually* changed and then intelligently maps those changes to the specific tests that cover that code. So, instead of running the whole world, it runs the three tests that actually matter. It’s… um, it’s basically near-instant feedback. Host: Wait, so it’s not just looking at the file name? Like, if I change `User.php`, it doesn't just run `UserTest.php`? Guest: Exactly! It’s much smarter than that. It actually analyzes the coverage map. It knows that even though you changed a Model, it might affect a specific API endpoint test or a Service class. It’s the difference between a blunt instrument and a scalpel. I was working on a legacy monolith last month—about 4,000 tests—and the full suite took about 12 minutes. With Tia enabled? My average test run for a feature change went down to about eight seconds. Host: Eight seconds?! Oh, wow. That’s a huge difference for developer happiness. I mean, you don’t even have time to go get a coffee at that point. You actually have to… stay at your keyboard and keep working! Guest: [Laughs] It’s a productivity trap! But seriously, it changes the way you write code. You’re more likely to run tests frequently when they’re that fast. It becomes part of your thought process rather than a "chore" you do before you push. Host: That makes total sense. Now, let’s pivot to the other "elephant in the room"—AI. Pest 5 is introducing "Evals" for LLMs. Now, I’ve struggled with this. How do you test something that is inherently unpredictable? If I ask an AI to summarize a paragraph, it might give me a slightly different wording every single time. Traditional `assertEquals` just doesn't work there, right? Guest: That’s exactly the struggle. Actually, that’s where most people give up on testing AI features. They just "vibe check" it—you know, refresh the page a few times, see if the output looks okay, and pray it stays that way. But Pest 5 introduces this `toEvaluate` expectation. Instead of checking if the string is identical, you provide a closure that validates the *logic* or the *structure* of the response. Host: Interesting! So, can you give me a real-world example of what that looks like? Guest: Sure! So, let’s say you have an AI agent that’s supposed to return a JSON object with a "summary" and a "status." Instead of checking for a specific string, you use an Eval to decode that JSON and verify that the "status" key exists and equals "success." Or, even cooler, you can use another, smaller LLM or a semantic tool inside that Eval to check if the summary actually contains the key points of the original text. It gives you a way to say, "I don't care exactly how you word it, as long as you follow these rules." Host: Oh, I love that. It’s like setting boundaries for a creative toddler. You don't care what they draw, as long as they stay on the paper. Guest: [Laughs] That is a perfect analogy! And Pest 5 also supports "AI Agents" directly. This is still pretty "bleeding edge," but the idea is that you can have an agent that actually suggests tests for you or helps identify edge cases you might have missed. It’s moving from "testing as a check" to "testing as a collaboration." Host: That feels like a big jump for the PHP community. We’re often seen as the "old reliable" language, but here we are, pushing into AI testing frameworks before some of the "trendier" languages. Why do you think Pest is the one leading this charge? Guest: I think it’s the philosophy of the framework. Pest has always been about "developer joy." Nuno and the team are obsessed with the experience of writing code. When they saw that everyone was building AI wrappers and LLM integrations but no one knew how to test them reliably, they saw a gap. PHP isn't just for simple CRUD apps anymore; we’re building complex, intelligent systems, and we need tools that respect that complexity. Host: So, if someone is listening and they’re currently on Pest 4, or maybe even still on PHPUnit—don't worry, we won't judge—how hard is it to move over to Pest 5? Is this a "break everything and start over" kind of update? Guest: Not at all! That’s the best part. For most projects, it’s literally just a `composer update`. The team has worked really hard to make it backwards compatible. Now, to get the *benefits* of Tia or the AI Evals, you’ll need to do a little bit of configuration in your `Pest.php` file, but the core experience is the same. The docs are already updated, and they are—honestly—some of the best in the business. Host: That’s great to hear. I think sometimes we hear "Major Version" and our blood pressure just spikes thinking about the refactoring. Guest: [Laughs] Total "Update PTSD," right? But no, this is a very friendly upgrade. The biggest challenge is just shifting your mindset to realize that your tests don't have to be slow anymore. You have to unlearn that "waiting period." Host: Honestly, Marcus, this sounds like a massive win for everyone. Between getting hours of our lives back with the Tia Engine and finally having a sane way to test LLM outputs with Evals, Pest 5 feels like it’s setting the bar for the next few years of PHP development. Guest: Thanks for having me, Alex! Happy testing, everyone. Host: And thanks to all of you for tuning in to Allur. Whether you’re refactoring a monolith or building the next great AI-powered app, I hope this helps you build with a little more confidence and a lot more speed. I’m Alex Chan, and I’ll catch you in the next episode!

Tags

llms software engineering php testing artificial intelligence pest tia engine