laravel-tdd

Implements test-driven development for Laravel applications using PHPUnit and Pest.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill laravel-tdd-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: laravel-tdd
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/laravel-tdd
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill laravel-tdd-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing reliable Laravel tests requires consistent decisions about test layers, database strategies, fakes, and coverage targets, and this Skill provides a structured red-green-refactor workflow so tests are written before implementation with 80%+ coverage. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides writing a failing test first, implementing the minimal change to pass, then refactoring while keeping tests green. - Test Layer Strategy: Distinguishes unit, feature, and integration tests with guidance on database traits like RefreshDatabase, DatabaseTransactions, and DatabaseMigrations. - Fakes and Isolation: Covers Bus, Queue, Mail, Notification, Event, and Http fakes plus Sanctum auth and Inertia assertions for deterministic tests. - Use Case: When adding a new API endpoint to a Laravel app, use this Skill to write a failing Pest feature test with factories and RefreshDatabase, then implement the controller until the test passes. ## Quick Start Write a failing Pest feature test for a new Laravel endpoint that creates a project, then implement the minimal code to make it pass.

Frequently Asked Questions about laravel-tdd

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

FAQPage Schema
How do I write feature tests for Laravel API endpoints?▼

Write feature tests using PHPUnit or Pest with the RefreshDatabase trait, authenticate with actingAs or Sanctum::actingAs, send requests like postJson, and assert on status codes and database state with assertDatabaseHas.

Pest vs PHPUnit for Laravel testing, which should I use?▼

Default to Pest for new tests when available since it offers a concise functional syntax. Use PHPUnit only if the project already standardizes on it or requires PHPUnit-specific tooling.

RefreshDatabase vs DatabaseTransactions in Laravel tests?▼

RefreshDatabase is the default for tests touching the database, running migrations once and wrapping tests in transactions. Use DatabaseTransactions when the schema is already migrated and you only need per-test rollback.

How do I test queued jobs and notifications in Laravel?▼

Use Queue::fake() with Queue::assertPushed for jobs and Notification::fake() with Notification::assertSentTo for notifications. These fakes isolate side effects so tests stay deterministic without executing real work.

How do I test Inertia.js pages in Laravel?▼

Use the assertInertia method with AssertableInertia to check the component name and props, such as ->component('Dashboard') and ->where('user.id', $user->id). Prefer this over raw JSON assertions to match Inertia responses.