laravel-testing

Structure and write Laravel 12 tests using Pest with mocking guidance.

Updated May 2, 2026
One-click install
npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-testing-abdallhmoukdad
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: laravel-testing
Source: https://github.com/abdallhMoukdad/laravel-agent-skills/tree/main/skills/laravel-testing
Command: npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-testing-abdallhmoukdad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill simplifies the process of writing, organizing, and executing tests in Laravel 12 by providing detailed guidelines and best practices.

Core Features & Use Cases

  • Testing Framework Setup: Guides developers to utilize Pest as the default test runner, enhancing test readability and maintainability.
  • Test Types and Organization: Differentiates between feature and unit tests, illustrating how to structure and isolate tests for services, controllers, and actions.
  • Best Practices: Demonstrates how to mock external services like mail, queue, and HTTP requests, while emphasizing the importance of fake setups before actions.
  • Real-World Application: Assists developers in creating reliable, fast, and maintainable tests for API endpoints and service classes, fostering best practices across projects.

Quick Start

Follow the Pest PHP setup instructions to organize your tests into feature and unit folders, and begin writing expressive tests with it() and expect().

Frequently Asked Questions about laravel-testing

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

FAQPage Schema
How do I structure feature and unit tests in a Laravel application?▼

To structure Laravel tests, separate feature and unit tests into distinct folders. Isolate tests for services, controllers, and actions to ensure code reliability and improve development speed.

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

The best way to mock external services in Laravel tests is to use fake setups before executing actions. Mock mail, queue, and HTTP requests to isolate test environments and validate code behavior accurately.

How do I set up Pest as my test runner for Laravel 12?▼

To set up Pest for Laravel 12, follow the Pest PHP setup instructions to organize tests into feature and unit folders. Use expressive functions like `it()` and `expect()` to enhance test readability and maintainability.

Why should I use Pest over PHPUnit for Laravel testing?▼

You should use Pest over PHPUnit to enhance test readability and maintainability. Pest allows developers to write expressive tests using `it()` and `expect()`, streamlining the creation of reliable and fast test suites.

How do I write reliable tests for Laravel API endpoints?▼

To write reliable tests for Laravel API endpoints, differentiate between feature and unit tests while mocking external services like HTTP requests. Emphasize fake setups before actions to foster best practices across projects.

When do I need to fake mail and queue setups in Laravel tests?▼

You need to fake mail and queue setups in Laravel tests before executing actions to prevent external side effects. Mocking these services ensures your tests remain fast, isolated, and maintainable.