php-testing
Installation
SKILL.md
PHP Testing
Priority: P1 (HIGH)
Structure
See implementation examples for test directory layout.
Write Tests with PHPUnit and Pest
- Standards: Use
PHPUnit(9/10+) orPest. Organize intoUnit/,Integration/, andFeature/. Class names should extendTestCase. - TDD Workflow: Follow Red-Green-Refactor. Write failing test first, implement minimal logic, then refactor.
See implementation examples for PHPUnit service test with mock.
Apply Assertions and Data Providers
- Fluent Assertions: Use
assertSame(===) overassertEqualsto avoid type coercion. Also useassertCount()andassertMatchesRegularExpression(). - Data Providers: Use
#[DataProvider('statusProvider')](PHPUnit 10+) ordataset(Pest).