laravel-tdd

Guide Laravel TDD workflows with PHPUnit and Pest testing strategies.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/TymorIbrahim/UniPilot --skill laravel-tdd-tymoribrahim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-tdd
Source: https://github.com/TymorIbrahim/UniPilot/tree/main/.cursor/skills/laravel-tdd
Command: npx skills add https://github.com/TymorIbrahim/UniPilot --skill laravel-tdd-tymoribrahim

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill equips developers with comprehensive Laravel testing strategies, enabling the creation of robust applications through Test-Driven Development (TDD).

Core Features & Use Cases

  • Testing Strategies: Provides guidance on PHPUnit and Pest for unit and feature testing.
  • Model Factories: Demonstrates the use of Laravel factories for efficient test data creation.
  • HTTP and API Testing: Includes examples of testing Laravel controllers and JSON APIs.
  • Authentication Testing: Covers testing authentication using Sanctum and Passport.
  • Mocking and Fakes: Offers insights into mocking external services and system components.
  • Use Case: If you're developing a Laravel application and want to implement TDD for a seamless and maintainable codebase, this Skill is for you.

Quick Start

To begin TDD for your Laravel application, run the provided PHPUnit configuration file and start writing your tests following the RED-GREEN-REFACTOR cycle.

Frequently Asked Questions about laravel-tdd

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

FAQPage Schema
How do I implement TDD in a Laravel application?

Testing Laravel APIs involves making HTTP requests and asserting JSON responses. You can use PHPUnit or Pest to test controllers and JSON APIs, leveraging Laravel factories to efficiently generate the required test data.

How do I test authentication in Laravel using Sanctum or Passport?

Testing authentication in Laravel requires verifying protected routes using Sanctum or Passport. You can authenticate test users via HTTP tests and assert access to guarded endpoints works correctly.

Does this Laravel testing guidance support both PHPUnit and Pest?

Yes, this Laravel testing guidance supports both PHPUnit and Pest. It provides comprehensive strategies for unit and feature testing, covering model factories, authentication, mocking, and coverage across both frameworks.

How do I use Laravel factories for test data creation?

Laravel factories generate test data by defining model attributes. You use them during testing to efficiently populate databases with dummy data, ensuring your tests run against a consistent state.

What is the best way to mock external services in Laravel tests?

Mocking external services in Laravel tests involves using fakes to simulate API responses and system components. This isolates your application logic during testing, preventing external network calls from affecting test reliability.