laravel:controller-tests

Test Laravel controllers with HTTP assertions for validation, authentication, and responses.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill laravel-controller-tests-patkik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel:controller-tests
Source: https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2/tree/main/.agents/skills/controller-tests
Command: npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill laravel-controller-tests-patkik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing focused tests for Laravel controllers can be verbose when business logic remains in controllers. By guiding you to move heavy logic into Actions/Services and validating endpoints with HTTP assertions, it reduces duplication and improves maintainability.

Core Features & Use Cases

  • Focused controller tests that verify HTTP request/response behavior using Laravel's HTTP assertions.
  • Encourages extracting business logic into Actions/Services with dedicated unit tests for those components.
  • Supports realistic data scenarios with factories and input validation with Form Requests in tests.

Quick Start

Run a focused controller test suite to verify HTTP responses for key endpoints.

Frequently Asked Questions about laravel:controller-tests

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

FAQPage Schema
How do I test Laravel controllers without duplicating business logic?

To test Laravel controllers without duplicating logic, move heavy processing into Actions or Services and use HTTP assertions to verify endpoint responses, authentication, and validation separately.

What are Laravel HTTP assertions and when should I use them?

Laravel HTTP assertions validate endpoint behavior by checking response statuses, headers, and content during testing. Use them to ensure controllers correctly handle HTTP requests while keeping business logic separate.

Can I use Laravel factories and Form Requests in controller tests?

Yes, you can use Laravel factories to generate realistic data scenarios and Form Requests to handle input validation within your controller tests to ensure endpoints enforce rules correctly.

What is the best way to structure unit tests for Laravel Actions and Services?

The best way to structure unit tests for Laravel Actions and Services is to test them in isolation from the controller layer, using dedicated unit tests for components while controllers rely on HTTP assertions.

Does focused controller testing work for endpoints that require authentication?

Focused controller testing works for authenticated endpoints by using HTTP assertions to verify that authentication rules are reliably enforced during HTTP request and response cycles.