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-code

Installs 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
1affaan-m avatarai-regression-testingaffaan-m/everything-claude-codeai regression testing4.8Kskills.sh installs
2affaan-m avatarkotlin-testingaffaan-m/everything-claude-codekotlin testing4.8Kskills.sh installs
3affaan-m avatarperl-testingaffaan-m/everything-claude-codeperl testing4.5Kskills.sh installs
4affaan-m avatarbrowser-qaaffaan-m/everything-claude-codebrowser qa4.3Kskills.sh installs
5affaan-m avatarcsharp-testingaffaan-m/everything-claude-codecsharp testing3.6Kskills.sh installs
6sickn33 avatarplaywright-skillsickn33/antigravity-awesome-skillsplaywright skill3.5Kskills.sh installs