
Laravel Tdd
A solid TDD workflow for Laravel that defaults to Pest but keeps PHPUnit examples when you need them. Covers the usual suspects: factories, database testing with RefreshDatabase, fakes for queues and notifications, and Sanctum auth. The examples are practical, showing feature tests for HTTP endpoints, unit tests for services, and even Inertia prop assertions. It pushes for 80% coverage and leans on the red-green-refactor cycle without being dogmatic. The database strategy guidance is genuinely helpful, especially the note that RefreshDatabase uses transactions per test when supported but re-migrates for in-memory SQLite. Good for both greenfield Laravel projects and adding tests to existing ones.
- skills.sh installs
- 5.1K
- GitHub stars
- 229.1K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add affaan-m/everything-claude-code --skill laravel-tdd --agent claude-codeInstalls into .claude/skills of the current project.
Files
Laravel Testing with TDD
Test-driven development for Laravel applications using PHPUnit, Pest, Laravel factories, and testing helpers.
When to Activate
- Writing new Laravel applications or features
- Implementing API endpoints with Sanctum or Passport authentication
- Testing Eloquent models, relationships, scopes, and accessors
- Setting up testing infrastructure for Laravel projects
- Writing feature tests for HTTP controllers and form requests
- Mocking external services (queues, mail, notifications, HTTP)
TDD Workflow for Laravel
Red-Green-Refactor Cycle
// Step 1: RED — Write a failing test
public function test_a_product_can_be_created(): void
{
$product = Product::factory()->create(['name' => 'Test Product']);
$this->assertDatabaseHas('products', ['name' => 'Test Product']);
}
// Step 2: GREEN — Write the migration, model, and factory
// Step 3: REFACTOR — Improve while keeping tests green
Setup
PHPUnit Configuration
Sponsors
Details
- Repository
- github.com/affaan-m/everything-claude-code
- Categories
- Testing & QA, PHP & Laravel
- First seen
- Apr 16, 2026
More from affaan-m/everything-claude-code
All 256- Regex Vs Llm Structured Text5.1K
- Compose Multiplatform Patterns5K
- Continuous Agent Loop5K
- Foundation Models On Device5K
- Investor Outreach5K
- Kotlin Patterns5K
- Rust Patterns5K
- Swift Actor Persistence5K
- Swift Protocol Di Testing5K
- Bun Runtime4.9K
- Nextjs Turbopack4.9K
- Plankton Code Quality4.9K
- Swift Concurrency 6 24.9K
- Visa Doc Translate4.9K
- Ai Regression Testing4.8K
- Architecture Decision Records4.8K
- Blueprint4.8K
- Everything Claude Code Conventions4.8K
- Exa Search4.8K
- Kotlin Testing4.8K
- Customs Trade Compliance4.7K
- Data Scraper Agent4.7K
- Documentation Lookup4.7K
- Enterprise Agent Ops4.7K