phpunit-best-practices

Installation
SKILL.md

PHPUnit Best Practices

Comprehensive testing best practices guide for PHPUnit applications, maintained by pentiminax. Contains 40 rules across 8 categories, prioritized by impact to guide automated test generation, refactoring, and code review.

When to Apply

Reference these guidelines when:

  • Writing new PHPUnit test classes or test methods
  • Reviewing test code for quality and consistency
  • Refactoring existing test suites
  • Configuring PHPUnit XML settings
  • Setting up code coverage and test organization

Rule Categories by Priority

Priority Category Impact Prefix
1 Principles & Patterns CRITICAL principle-
2 Coding Standards CRITICAL standard-
3 Test Attributes HIGH attr-
4 Data Management HIGH data-
5 Test Documentation MEDIUM doc-
6 Mocking MEDIUM mock-
7 Integration Testing MEDIUM integration-
8 Configuration LOW-MEDIUM config-

Quick Reference

1. Principles & Patterns (CRITICAL)

2. Coding Standards (CRITICAL)

3. Test Attributes (HIGH)

4. Data Management (HIGH)

5. Test Documentation (MEDIUM)

6. Mocking (MEDIUM)

7. Integration Testing (MEDIUM)

8. Configuration (LOW-MEDIUM)

How to Use

Read individual rule files for detailed explanations and code examples:

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references
Installs
3
First Seen
Mar 3, 2026