Php Test Writer
Generates PHPUnit tests from code snippets to automate testing and improve software quality.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add php-test-writer npx -- -y @trustedskills/php-test-writer
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"php-test-writer": {
"command": "npx",
"args": [
"-y",
"@trustedskills/php-test-writer"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
The php-test-writer skill automatically generates PHPUnit tests for existing PHP code. It analyzes the provided code and creates corresponding test files with assertions to verify functionality. This helps ensure code quality, facilitates refactoring, and simplifies automated testing workflows.
When to use it
- New Project Setup: Quickly generate a basic test suite when starting a new PHP project.
- Legacy Code Testing: Add tests to existing codebases that lack automated testing.
- Refactoring Assistance: Ensure changes during refactoring don't break existing functionality.
- Automated CI/CD Pipelines: Integrate into continuous integration and delivery pipelines for automatic test execution.
Key capabilities
- Generates PHPUnit test files.
- Analyzes existing PHP code.
- Creates assertions to verify functionality.
Example prompts
- "Generate a PHPUnit test suite for this code: [paste PHP code here]"
- "Create tests for the
UserControllerclass in my project." - "Write unit tests for the function
calculate_discount."
Tips & gotchas
- The skill is most effective with well-structured and documented PHP code. Complex or obfuscated code may result in less accurate test generation.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.