- Home
- Skills
- Masanao Ohba
- Claude Manifests
- Testing Standards
testing-standards_skill
- Shell
2
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill masanao-ohba/claude-manifests --skill testing-standards- SKILL.md13.8 KB
Overview
This skill documents PHPUnit testing conventions and practical best practices for any PHP project. It focuses on test structure, naming, assertions, test doubles, organization, coverage, and Docker-based execution to ensure reliable, maintainable test suites. Use it as a reference to standardize tests across teams and frameworks.
How this skill works
The skill lays out concrete patterns and examples: class structure with setUp/tearDown, AAA and Given-When-Then patterns, data providers, and mock/stub/spy usage. It prescribes assertion choices, documentation practices, test grouping, coverage annotations, and a strict skipped-test policy. It also enforces Docker-based execution and provides a pre-execution checklist for consistent environments.
When to use it
- When establishing or auditing PHPUnit test standards for a project or team
- When writing new unit, integration, or functional tests
- When introducing CI/CD and coverage requirements
- When troubleshooting flaky tests or inconsistent test environments
- When onboarding developers to project testing conventions
Best practices
- Name tests descriptively and test one behavior per test (use testMethodScenario or @test style)
- Follow Arrange-Act-Assert or Given-When-Then patterns to keep tests readable
- Prefer data providers for repetitive cases and keep fixtures small and focused
- Use mocks, stubs, and spies appropriately: mock interactions, stub returns, spy side effects
- Document tests and classes with clear PHPDoc and @covers annotations for coverage accuracy
- Run tests inside Docker containers and maintain a pre-execution checklist to avoid environment drift
Example use cases
- Unit testing a service with repository mocks to verify interaction and returned data
- Using data providers to validate multiple email formats or input permutations
- Integration tests for repositories and database behavior under Dockerized test DB
- Functional API tests that exercise end-to-end flows with clear grouping (unit/integration/functional)
- Enforcing coverage by adding @covers and ignoring legacy code with @codeCoverageIgnore only when necessary
FAQ
Mock or stub external API calls in unit tests. For integration tests, run against a controlled test instance or use recorded responses. Never skip tests because an external service is unavailable.
When is it acceptable to skip a test?
Only for confirmed future features with a ticket/issue number, target version, and team approval. Skips must be documented and rare; otherwise fix or remove the test.