一键导入
php-testing
PHP testing patterns: PHPUnit, test doubles, database testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
PHP testing patterns: PHPUnit, test doubles, database testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Planning lifecycle: specs, requirements, pre-plan ambiguity resolution, file-backed plans, plan validation, pause/resume, session handoff.
Fresh-subagent-per-task execution with two-stage review gates.
Comprehensive 3-wave review of all repo source files, producing a prioritized issue backlog.
Business operations: strategy, technology, growth, competitive intelligence, support, finance, HR, legal, operations, sales, productivity, product management.
Customer support workflows — ticket triage, response drafting, knowledge base articles, escalation handling, customer research. Use when triaging support tickets, drafting customer responses, creating KB articles, managing escalations, or researching customer context.
Finance and accounting: journal entries, reconciliation, variance analysis, financial statements, audit support, month-end close, SOX testing.
| name | php-testing |
| promoted_to | php |
| description | PHP testing patterns: PHPUnit, test doubles, database testing. |
| user-invocable | false |
| context | fork |
| agent | php-general-engineer |
| routing | {"triggers":["php testing","phpunit","pest php","php mock"],"category":"php","pairs_with":["php-quality","test-driven-development"]} |
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.