laravel-testing

Provide Laravel testing patterns using Pest for feature and action tests.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/SamuelBisberg/exam-arena --skill laravel-testing-samuelbisberg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-testing
Source: https://github.com/SamuelBisberg/exam-arena/tree/main/.agents/skills/laravel-testing
Command: npx skills add https://github.com/SamuelBisberg/exam-arena --skill laravel-testing-samuelbisberg

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides a comprehensive set of tools and patterns for effective testing in Laravel applications using Pest, a testing framework for PHP.

Core Features & Use Cases

  • Testing Patterns: Offers guidance on Arrange-Act-Assert patterns, mocking, factories, and more.
  • Action Testing: Demonstrates how to test domain logic in isolation.
  • Feature Testing: Covers how to test complete request/response cycles for HTTP endpoints.
  • Best Practices: Summarizes best practices for writing maintainable and robust tests.
  • Use Case: When developing Laravel applications and require a robust testing strategy to ensure code quality and reliability.

Quick Start

Run the testing skill to learn about different testing patterns and best practices in Laravel.

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 Arrange-Act-Assert pattern in Pest?

Arrange-Act-Assert in Laravel testing separates state setup, action execution, and assertion verification. Using Pest, this pattern structures feature and action tests sequentially to ensure domain logic is validated in clear, isolated steps.

What is the best way to test isolated domain logic in Laravel applications?

Testing isolated domain logic in Laravel uses action testing patterns to bypass HTTP requests. By mocking dependencies and utilizing factories, you validate specific domain rules directly, ensuring robust unit-level coverage without booting the full framework.

How do I write feature tests for HTTP endpoints in Laravel with Pest?

Feature testing in Laravel with Pest validates complete request and response cycles for HTTP endpoints. It leverages testing patterns to simulate HTTP requests, interact with the database, and assert outcomes, ensuring your application's endpoints function correctly.

Do I need PHPUnit installed to use Pest for Laravel testing?

Yes, Pest operates as a testing framework built on top of PHPUnit. To execute Laravel testing patterns with Pest, both Pest and PHPUnit dependencies must be present in your PHP environment to support the underlying testing mechanisms.

How does mocking improve test maintainability in Laravel?

Mocking improves Laravel test maintainability by isolating the system under test from external dependencies. By simulating object behaviors, mocking ensures tests run faster and remain robust against external changes, adhering to best practices for reliable testing.

When should I use factories instead of mocking in Laravel tests?

Use factories for realistic database state setup and mocking for isolating external services. In Laravel testing, factories generate database records for feature tests, while mocking prevents actual service calls, balancing integration depth with isolation.