tdd-php

Apply Test-Driven Development practices to PHP backends using PHPUnit and Behat.

1|Updated Dec 10, 2025
One-click install
npx skills add https://github.com/jakubciszak/family-plan --skill tdd-php
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-php
Source: https://github.com/jakubciszak/family-plan/tree/main/.claude/skills/tdd-php
Command: npx skills add https://github.com/jakubciszak/family-plan --skill tdd-php

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-Driven Development helps PHP backend teams catch bugs early by writing tests before code, reducing debugging time and improving design.

Core Features & Use Cases

  • Red-Green-Refactor cycle guidance to ensure tests drive development and maintain code quality.
  • Supports Unit, Integration, API, and Behat Acceptance testing with clear patterns and examples, including the Mother data builder pattern.
  • Clear coding practices for PHP backends using PHPUnit and Behat, with naming conventions and test organization.

Quick Start

Begin by writing a failing PHPUnit or Behat test for a PHP class, then implement the feature to make the test pass.

Frequently Asked Questions about tdd-php

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply test-driven development to a PHP backend using PHPUnit?

To apply test-driven development in PHP, you write a failing PHPUnit test for a class before implementing the production code, then write the feature to make the test pass. This enforces the Red-Green-Refactor cycle to drive development and improve code design.

What is the Red-Green-Refactor cycle in PHP testing?

The Red-Green-Refactor cycle in PHP testing is a TDD practice where you write a failing test, implement the minimum code to make it pass, and then refactor. This cycle ensures tests drive development and maintain code quality across your backend.

How do I structure unit and acceptance tests in a PHP project?

You structure unit and acceptance tests in a PHP project by organizing them under tests/ directories. This approach supports clear test organization for unit, integration, API, and Behat acceptance testing using established naming conventions and patterns like the Mother data builder.

Can I use Behat for acceptance testing in PHP 8+?

Yes, you can use Behat for acceptance testing in PHP 8+. This TDD approach aligns with PHP 8+ ecosystems and provides clear patterns and examples for writing robust acceptance tests alongside unit and integration testing.

What is the best way to manage test data in PHPUnit?

The best way to manage test data in PHPUnit is using the Mother data builder pattern. This pattern provides clear coding practices for constructing test objects, ensuring your unit and integration tests remain maintainable and readable.

Why does writing tests before production code improve PHP backends?

Writing tests before production code improves PHP backends by catching bugs early and reducing debugging time. This test-driven development approach ensures your code quality and design are driven by clear testing requirements from the start.