laravel-tdd

Establish a test-driven workflow for Laravel applications using PHPUnit or Pest.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill laravel-tdd-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-tdd
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/laravel-tdd
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill laravel-tdd-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the difficulty of building reliable Laravel applications by teaching a repeatable test-driven development workflow that keeps unit and feature coverage high and reduces regressions.

Core Features & Use Cases

  • Red-Green-Refactor TDD cycle: Write a failing test, implement the minimal change to pass, then refactor while keeping tests green.
  • Test layering guidance: Choose the right test type for the scope, from unit (pure PHP) to feature (HTTP/auth/validation) to integration (DB/queues/external boundaries).
  • Laravel testing strategy: Use the appropriate database refresh mechanism (defaulting to RefreshDatabase), leverage factories/states, and isolate side effects with fakes (Queue, Mail, Notification, Event) and Http fakes.

Quick Start

Ask the AI to design a Laravel TDD plan for a new API endpoint, including which Pest vs PHPUnit tests to write, what database refresh strategy to use, and which assertions should validate the JSON response shape.

Frequently Asked Questions about laravel-tdd

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

FAQPage Schema
How do I start test-driven development in Laravel?

Laravel test-driven development follows a red-green-refactor cycle: write a failing test, implement the minimal code to pass, then refactor while keeping tests green. This workflow applies to unit, feature, integration, database, queue, and notification testing scenarios.

How do I use Http::fake when integration testing external API calls in Laravel?

Http::fake isolates external API calls during Laravel integration testing by intercepting outbound requests so you can assert response shapes without hitting real services. It pairs with Queue::fake, Mail::fake, Notification::fake, and Event::fake to isolate all side effects.

What is the best way to handle database testing in Laravel TDD?

Database testing in Laravel TDD defaults to using the RefreshDatabase trait alongside Laravel factories and states. This ensures a clean schema state for each test while allowing you to generate predictable model data for feature and integration test assertions.

Does Laravel TDD workflow support both PHPUnit and Pest?

Yes, the Laravel TDD workflow supports writing failing tests and evolving code using either PHPUnit or Pest. Both frameworks utilize Laravel testing traits like RefreshDatabase and integrate with fakes for queues, mail, notifications, events, and HTTP requests.

How do I validate Inertia responses in a Laravel feature test?

Inertia response validation in Laravel feature tests checks the component name and props data structure returned by the endpoint. The TDD workflow guides you to write failing assertions for expected Inertia page properties before implementing the controller logic.