What problem does it solve?
PHP projects often struggle with inconsistent testing practices across unit and integration tests, leading to flaky results and hard-to-maintain test suites.
This skill provides stack-agnostic PHPUnit and Pest patterns to establish a uniform testing approach, including test structure, data providers, mocks, fixtures, and coverage targets.
Core Features & Use Cases
- Unified test patterns: Detects whether a project uses PHPUnit or Pest and applies the appropriate structure.
- Data-driven testing: Encourages data providers and datasets to cover multiple scenarios with minimal duplication.
- Test doubles discipline: Demonstrates proper use of mocks, stubs, and fakes to isolate the system under test.
- Fixtures and setup: Provides guidance on setUp/tearDown and in-memory fixtures for reliable tests.
- Quality goals: Aims for meaningful coverage targets and clean test organization across the codebase.
Quick Start
Create a test folder with a simple unit test using either PHPUnit or Pest and follow the Arrange-Act-Assert pattern to validate a small domain object.