skills/engineering/php-testing/SKILL.md
PHP testing patterns: PHPUnit, test doubles, database testing.
npx skillsauth add notque/claude-code-toolkit php-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.mdfor full code examples, the failure modes table, and the commands reference.
| 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. |
Determine what needs testing:
TestCase with test prefix or @test annotation@dataProvider static methodsDatabaseTransactions (Laravel) or KernelTestCase (Symfony)WebTestCaseWrite tests following these rules:
parent::setUp() first in every setUp() methodassertSame() instead of assertTrue($a === $b) for meaningful failure messages@depends chains@dataProvider rather than duplicating test methodsFor test doubles: use createStub() when you only need return values, createMock() when asserting method calls, and Prophecy (phpspec/prophecy-phpunit) for more expressive interaction assertions.
For database tests: use DatabaseTransactions (Laravel) or DoctrineTestBundle (Symfony) to roll back state after each test.
Run the test suite and confirm all tests pass:
./vendor/bin/phpunit
For coverage enforcement:
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-min=80
GATE: All tests pass. Coverage threshold met if configured. No failure modes from references/patterns.md introduced.
tools
Shell configuration: Fish and Zsh setup, PATH, completions, plugins.
tools
Kubernetes operations: debugging, security, RBAC, and infrastructure tooling.
development
Swift development: concurrency patterns, async/await, actors, testing with XCTest and Swift Testing framework.
development
PHP development: code quality, PSR standards, testing with PHPUnit.