laravel-tdd

Implement test-driven development for Laravel using PHPUnit and Pest.

1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/zero3041/PREP --skill laravel-tdd-zero3041
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-tdd
Source: https://github.com/zero3041/PREP/tree/main/.claude/skills/skills/laravel-tdd
Command: npx skills add https://github.com/zero3041/PREP --skill laravel-tdd-zero3041

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires phpunit, pest, laravel, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of implementing effective test-driven development (TDD) in Laravel applications, enhancing code quality and maintainability.

Core Features & Use Cases

  • Test-Driven Development: Facilitates the TDD workflow for Laravel with PHPUnit and Pest.
  • Testing Frameworks: Offers guidance on using PHPUnit and Pest for different testing layers.
  • Database Strategies: Provides strategies for database interactions in tests.
  • Feature Test Examples: Includes examples for HTTP layer testing with PHPUnit and Pest.
  • Factories and States: Offers best practices for creating test data.
  • Persistence Test Example: Demonstrates how to test database interactions.
  • Fakes for Side Effects: Explains how to use fakes for jobs, queues, and notifications.
  • Auth Testing: Covers testing authentication with Sanctum.
  • Inertia Feature Tests: Includes examples for testing Inertia components.
  • Coverage Targets: Sets a target for code coverage to ensure robust testing.
  • Test Commands: Lists commands for running tests.
  • Test Configuration: Offers configuration tips for fast tests.
  • Authorization Tests: Provides examples for testing authorization.

Quick Start

Run the laravel-tdd skill to set up the testing environment for a new Laravel project.

Frequently Asked Questions about laravel-tdd

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

FAQPage Schema
How do I implement test-driven development in Laravel using PHPUnit and Pest?

To implement TDD in Laravel, use PHPUnit and Pest to facilitate the testing workflow across unit, feature, and integration tests. This approach ensures high code coverage and testable code by writing tests before application logic.

What's the best way to test authentication with Sanctum in a Laravel application?

Testing authentication with Sanctum uses feature tests to simulate authenticated users and verify secure endpoint access. You leverage Laravel's built-in testing tools to assert protected routes and authorization policies behave correctly.

How do I test Inertia components and HTTP responses in Laravel?

Inertia feature tests in Laravel verify HTTP layer interactions and component rendering. You use PHPUnit or Pest to assert page props and component states, ensuring your frontend integration responds correctly.

How do I use fakes for jobs, queues, and notifications in Laravel tests?

Laravel provides fakes for jobs, queues, and notifications to test side effects without actual execution. You use the facade fakes to assert that specific events were dispatched during your test scenarios.

Does this Laravel TDD workflow require both PHPUnit and Pest to run tests?

Yes, the Laravel TDD workflow requires both PHPUnit and Pest dependencies. It leverages both frameworks to offer comprehensive testing strategies across different layers of your application for high code coverage.

How do I configure Laravel test databases and factories for high code coverage?

Achieving high code coverage involves using factories and states for test data generation and applying specific database interaction strategies. You configure fast tests by optimizing the test environment and utilizing persistence test examples.