laravel-testing

Test Laravel applications with Pest using AAA patterns and factories.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/helmordev/ecom-app --skill laravel-testing-helmordev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-testing
Source: https://github.com/helmordev/ecom-app/tree/main/.agents/skills/laravel-testing
Command: npx skills add https://github.com/helmordev/ecom-app --skill laravel-testing-helmordev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and best practices for testing Laravel applications using the Pest testing framework, ensuring robust, maintainable, and reliable code.

Core Features & Use Cases

  • Testing Patterns: Learn the Arrange-Act-Assert (AAA) pattern, mocking strategies, and null drivers for isolated and deterministic tests.
  • Action & Feature Testing: Understand how to effectively unit test domain logic (Actions) and feature test HTTP endpoints.
  • Factory Usage: Master model and DTO factories for creating realistic test data and declarative factory methods for readable tests.
  • Use Case: When developing a new feature in a Laravel application, use this Skill to write effective unit and feature tests that cover all scenarios, ensuring the feature works as expected and preventing regressions.

Quick Start

Use the laravel-testing skill to write a unit test for the CreateOrderAction class following the AAA pattern.

Frequently Asked Questions about laravel-testing

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

FAQPage Schema
How do I write a unit test for a Laravel Action using Pest?

To write a unit test for a Laravel Action using Pest, follow the Arrange-Act-Assert (AAA) pattern to isolate domain logic, set up necessary mocking, and verify expected outcomes deterministically. This ensures your Action logic remains robust and maintainable.

What's the best way to structure feature testing for HTTP endpoints in Laravel?

The best way to structure feature testing for HTTP endpoints in Laravel is by using Pest to test routes and controllers directly. Combine model factories for realistic test data with null drivers to ensure isolated, reliable HTTP tests that avoid brittle dependencies.

How do model and DTO factories improve Laravel testing workflows?

Model and DTO factories improve Laravel testing workflows by generating realistic test data and enabling declarative factory methods. This approach makes tests more readable and maintainable while ensuring your test suite remains isolated and deterministic.

Why does my Laravel test suite have brittle tests, and how can I fix it?

Your Laravel test suite has brittle tests likely due to unisolated dependencies and external side effects. Fix this by implementing effective mocking strategies and using null drivers to isolate tests, ensuring reliable and maintainable test outcomes.

Can I use Pest for both unit testing and feature testing in a Laravel application?

Yes, you can use Pest for both unit testing and feature testing in a Laravel application. It effectively handles unit testing of domain Actions and feature testing of HTTP endpoints, providing comprehensive coverage with isolated and reliable test suites.