The Test Pyramid: Part 3 - Handling Errors in a REST API (PHP)

Опубликовано: 13 Май 2026
на канале: The Engineering Coach
373
7

Welcome back to our series on the Test Pyramid! I'm your Engineering Coach, and in this episode, we're taking our REST API to the next level by handling edge cases. We'll use Test-Driven Development (TDD) to add a new feature to our /books endpoint: handling requests for books that are not found.

You'll see how to use end-to-end tests to drive the implementation of a 404 Not Found response. We'll then use an integration test to ensure that our code correctly interacts with our database using Doctrine ORM when a book is unavailable. This video is an essential guide for anyone who wants to learn how to build resilient APIs that gracefully handle the unexpected.

The code for this episode can be found on GitHub: https://github.com/testingallthething...

Previous in the Series:
If you missed the previous videos, check out our guide on end-to-end and integration testing a new book endpoint:
👉 Watch The Test Pyramid: Part 2 here!

   • The Test Pyramid: Part 2 - E2E, Integratio...  

Let's Connect
For more software engineering tutorials and coaching, subscribe to The Engineering Coach on YouTube. You can also connect with me on Bluesky or Mastodon.

Mastodon: https://mastodon.social/@braddle
Bluesky: https://bsky.app/profile/braddle1.bsk...
LinkedIn:   / mark-bradley-engineering-coach  

#TestPyramid #RESTAPI #TDD #ErrorHandling #PHP #IntegrationTesting #TheEngineeringCoach