php-testing
FeaturedPHP testing patterns: PHPUnit, test doubles, database testing.
Testing & QA 412 stars
42 forks Updated 2 days ago MIT
Install
Quality Score: 96/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# PHP Testing Skill
## Overview
Apply PHPUnit testing patterns for PHP projects: unit tests with data providers, test doubles (stubs, mocks, Prophecy), database testing (Laravel/Symfony), HTTP testing, and coverage configuration.
> See `references/patterns.md` for full code examples, the failure modes table, and the commands reference.
## Reference Loading Table
| Signal | Load These Files | Why |
|---|---|---|
| writing PHPUnit tests: data providers, mocks/stubs, database or HTTP tests, coverage config | `patterns.md` | Loads detailed guidance from `patterns.md`. |
## Instructions
### Phase 1: IDENTIFY
Determine what needs testing:
- Unit logic: use PHPUnit `TestCase` with `test` prefix or `@test` annotation
- Table-driven cases: use `@dataProvider` static methods
- Collaborator behavior: use stubs (return values only) or mocks (assert interactions)
- Database state: use `DatabaseTransactions` (Laravel) or `KernelTestCase` (Symfony)
- HTTP endpoints: use Laravel HTTP helpers or Symfony `WebTestCase`
### Phase 2: WRITE
Write tests following these rules:
- Call `parent::setUp()` first in every `setUp()` method
- Use `assertSame()` instead of `assertTrue($a === $b)` for meaningful failure messages
- Mock only collaborators and dependencies, never the class under test
- Keep tests independent -- do not use `@depends` chains
- Extract repetitive cases to `@dataProvider` rather than duplicating test methods
For test doubles: use `createStub()` when you only need return ...
Details
- Author
- notque
- Repository
- notque/vexjoy-agent
- Created
- 4 months ago
- Last Updated
- 2 days ago
- Language
- Python
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Solid
testing
This skill should be used when the user asks to "write tests", "fix failing tests", "improve test coverage", "add integration tests", "debug a flaky test", or reviews test quality. Provides behavior-focused testing patterns, coverage analysis, and detection of brittle test anti-patterns like implementation coupling and non-deterministic assertions.
17 Updated yesterday
dean0x Testing & QA Listed
testing
Testing strategies, patterns, and best practices
0 Updated today
murtazatouqeer Testing & QA Solid
testing
Comprehensive testing patterns and anti-patterns for writing and reviewing tests
1,138 Updated today
vm0-ai