laravel-tdd

Identify and fix Laravel defects using PHPUnit and Pest TDD cycles.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/SOLEROM/cldlab --skill laravel-tdd-solerom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-tdd
Source: https://github.com/SOLEROM/cldlab/tree/main/ecc/ref_claude/skills/laravel-tdd
Command: npx skills add https://github.com/SOLEROM/cldlab --skill laravel-tdd-solerom

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel applications often suffer from brittle codebases and regression risk as projects grow; test-driven development with PHPUnit and Pest provides a disciplined workflow to confirm behavior before implementation, including factories, database testing, fakes, and coverage targets.

Core Features & Use Cases

  • Red-Green-Refactor workflow for Laravel tests using PHPUnit and Pest.
  • Comprehensive guidance for unit, feature, and integration tests across models, controllers, queues, jobs, policies, and HTTP endpoints.
  • Database strategies and test doubles (factories, fakes) to ensure reliable, repeatable test suites with clear coverage targets.

Quick Start

Install Pest and PHPUnit in your Laravel project, write a failing test, then implement the minimal code to pass and refactor while keeping tests green.

Frequently Asked Questions about laravel-tdd

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

FAQPage Schema
How do I apply TDD to Laravel applications using PHPUnit and Pest?

Apply TDD to Laravel by following the Red-Green-Refactor cycle using PHPUnit and Pest. Write a failing test first, implement the minimal code to pass, then refactor while keeping tests green across models, controllers, and HTTP endpoints.

What's the best way to test Laravel controllers and jobs with database migrations?

Testing Laravel controllers and jobs requires robust database strategies like RefreshDatabase, transactions, or migrations. Combine these with factories and fakes to ensure repeatable test suites and clear coverage targets across typical workflows.

Does Pest work with Laravel for feature and integration testing?

Pest works with Laravel for feature and integration testing alongside PHPUnit. Apply tests across models, controllers, queues, jobs, policies, and HTTP endpoints to confirm behavior before implementation and reduce regression risk.

Why does my Laravel test suite become brittle as the project grows?

Laravel test suites become brittle due to missing test-driven development discipline. Using PHPUnit and Pest with factories, database testing, fakes, and coverage targets confirms behavior before implementation and prevents regression risk.

Can I use RefreshDatabase and factories for reliable Laravel database testing?

RefreshDatabase and factories ensure reliable Laravel database testing by managing state and generating test data. Apply these test doubles with fakes and assertions to maintain high coverage and repeatable test suites.

When do I need unit tests versus feature tests in Laravel workflows?

Unit tests validate isolated logic in Laravel models, while feature tests cover controllers, jobs, notifications, and HTTP endpoints. Both are needed to apply a comprehensive Red-Green-Refactor TDD cycle across typical Laravel workflows.