This repository contains all the code for the YouTube video tutorial, "TDD for Beginners: Let's Build a Queue from Scratch (PHP & PHPUnit)."
If you're looking to learn Test-Driven Development from a hands-on perspective, this is the perfect place to start. The code follows a strict "Red, Green, Refactor" approach as we build a Queue Abstract Data Type in PHP.
Watch the Full Tutorial on YouTube
This project is a practical example of how to apply the TDD methodology to a real programming problem. We start with a simple, failing test and build out a complete, robust data structure, one small step at a time. The code is written in PHP and uses the PHPUnit testing framework.
Key concepts explored in the tutorial:
- The "Red, Green, Refactor" cycle
- Writing isolated unit tests
- Using PHPUnit for TDD
- Refactoring tests and production code
- Building a Queue data structure
To run the code and follow along with the tutorial, you'll need PHP and Composer installed on your machine.
- Clone the repository:
git clone https://github.com/the-engineering-coach/001-queue
cd 001-queue- Install the dependencies:
composer install- Run the tests:
./vendor/bin/phpunitYou should see all tests pass! From there, you can experiment with the code or write your own tests to continue learning.
The Engineering Coach is a YouTube channel dedicated to helping software engineers and engineering managers improve their skills and craft. We provide practical advice and tutorials on topics that matter in the real world of software development.
For more software engineering tutorials and coaching, subscribe to The Engineering Coach on YouTube. You can also connect with me on Bluesky or Mastodon.
