laravel-testing

Write Laravel Pest tests using Triple-A patterns and declarative factories.

1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-testing-nextplus896
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-testing
Source: https://github.com/nextplus896/durra-alaseel/tree/main/.github/skills/claude-laravel/laravel-testing
Command: npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-testing-nextplus896

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing robust Laravel tests can be tedious and brittle without proven patterns. This skill consolidates Pest-based testing practices to promote isolation, readability, and maintainability across unit and feature tests.

Core Features & Use Cases

  • Triple-A pattern: Arrange-Act-Assert for clear tests that separate setup, action, and verification.
  • Declarative factories: Readable test data creation using factory methods instead of inline arrays.
  • Mocking & isolation: Guidance on when and what to mock, how to use null drivers, and how to resolve actions from the container.
  • Use Case: E.g., testing a Laravel service or controller by composing actions, factories, and mocks for deterministic results.

Quick Start

Install Pest in your Laravel project and follow the Triple-A approach:

  • Create a simple unit test using factories and the resolve() helper for actions.
  • Structure tests to be isolated, readable, and fast; avoid brittle assertions and heavy mocks.
  • Use the provided factory patterns to express business intent in tests.

Frequently Asked Questions about laravel-testing

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

FAQPage Schema
How do I structure Laravel tests using the Pest framework?

Use declarative factories in your Pest tests to express business intent clearly. Replace inline arrays with factory methods for readable test data creation, isolating data setup from action verification.

When should I use mocking in Laravel testing?

Use mocking in Laravel testing to isolate actions by replacing external dependencies with null drivers or container-resolved mocks. Mock selectively to avoid brittle, implementation-specific tests that break on refactoring.

How do I write action-based unit tests in Laravel?

Write action-based unit tests in Laravel by resolving actions from the container using the resolve() helper. Combine this with declarative factories and the Triple-A pattern for deterministic, isolated results.

What is the best way to avoid brittle Laravel tests?

Avoid brittle Laravel tests by enforcing declarative factories, the Triple-A pattern, and avoiding heavy mocks. Focus on behavior verification rather than implementation-specific assertions to maintain long-term test durability.

Can I test Laravel services and controllers with Pest without inline arrays?

Yes, you can test Laravel services and controllers with Pest without inline arrays by using declarative factories. Compose actions, factories, and mocks to achieve readable, maintainable, and deterministic feature tests.