backend-test-guidelines

Guide Laravel backend tests with a 7-layer architecture and PHPUnit.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/asakuno/template-repository --skill backend-test-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-test-guidelines
Source: https://github.com/asakuno/template-repository/tree/main/.claude/skills/backend-test-guidelines
Command: npx skills add https://github.com/asakuno/template-repository --skill backend-test-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill provides comprehensive guidelines for PHPUnit and Laravel testing within a 7-layer architecture, helping teams design consistent, high-quality unit and feature tests and avoid common AI mistakes.

Core Features & Use Cases

  • Establishes a standardized test strategy across Model, UseCase, Repository, and Controller layers.
  • Includes concrete patterns, directory structure templates, decision guides, and AI weakness checklists to improve test quality and consistency.
  • Provides references and examples to accelerate test design and review during Phase 2 (Testing & Review).

Quick Start

Consult Phase 2 testing guidelines and the references when writing or reviewing backend tests.

Frequently Asked Questions about backend-test-guidelines

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

FAQPage Schema
How do I structure PHPUnit tests for a Laravel application using a 7-layer architecture?

To structure PHPUnit tests in a 7-layer Laravel architecture, write unit tests for UseCases using mocked repositories, and feature tests for repositories and controllers to ensure proper authentication and Inertia assertions.

When should I use mocks vs databases in Laravel unit testing?

In Laravel unit testing, you should use mocks for repositories and avoid database interactions to keep tests isolated. Feature tests should handle database interactions and validate repository behaviors end-to-end.

How do I test Inertia responses in Laravel feature tests?

To test Inertia responses in Laravel feature tests, use specific Inertia assertions within your controller tests to verify component props and status codes while ensuring proper authentication and authorization checks are passed.

What is the best way to ensure consistent backend test coverage across Model, UseCase, and Repository layers?

The best way to ensure consistent backend test coverage is to apply standardized test strategies across Model, UseCase, and Repository layers, leveraging factories, mocks, and an AI weakness checklist to verify quality and consistency.

Does this testing guideline work without a specific directory structure?

No, this testing guideline provides directory structure templates and concrete patterns to standardize test design across layers, requiring alignment with the 7-layer architecture to effectively utilize the provided references and checklists.