/fuse-php:php-testingfrom fuse-php
Guides writing/configuring tests on non-Laravel PHP projects with PHPUnit 13 or Pest 5. Includes decision matrix, config templates, and test-double patterns.
Ships in fuse-php. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Includes a decision matrix for choosing between the two (team preference, not capability), plus templates for phpunit.xml, Pest.php setup, and test doubles (stubs, mocks, fixtures, coverage).
Do NOT use this skill for Laravel test helpers such as RefreshDatabase or HTTP testing — those are covered by laravel-expert's laravel-testing skill. Do NOT use it for static analysis or formatting tooling — that is php-quality-tooling.
Two frameworks, one engine. Pest is a layer over PHPUnit — both need PHP 8.4+ and share the same runner and assertions underneath.
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
After implementation, run fuse-ai-pilot:sniper for validation.
| Framework | Style | Strength |
|---|---|---|
| PHPUnit 13 | Class-based, xUnit | Enterprise baseline, explicit, widest tooling/CI support |
| Pest 5 | Closure-based, expressive | Modern DX, browser + arch + mutation testing, less boilerplate |
Pest 5 runs on PHPUnit 13's engine, so PHPUnit knowledge transfers directly. The choice is about ergonomics and team preference, not capability.
@test, @dataProvider)public static - Non-static providers no longer workcreateStub() is not configurable - Configure expectations only on createMock(); any() is hard-deprecated in PHPUnit 13 — use a stub or a real count (once(), exactly(n))Choosing a framework? (non-Laravel)
├── Enterprise / strict CI / mixed team → PHPUnit 13 (explicit, ubiquitous)
├── Modern DX, greenfield, small team → Pest 5 (concise, expressive)
├── Need browser / architecture / mutation testing out of the box → Pest 5
└── Migrating a large PHPUnit suite → stay PHPUnit, or drift-migrate to Pest
Honest note: PHPUnit is the enterprise/CI baseline; Pest has strong community momentum but that trend is not normative. Either is a correct, well-supported choice — pick per team, not per hype.
→ Full matrix in references/choosing-framework.md
| Topic | Reference | Load when |
|---|---|---|
| Framework choice | references/choosing-framework.md | Deciding PHPUnit vs Pest |
| PHPUnit 13 | references/phpunit-12.md | Writing PHPUnit tests |
| Pest 5 | references/pest-4.md | Writing Pest tests |
| Annotation migration | references/annotations-to-attributes.md | Upgrading pre-12 tests |
| Template | Use Case |
|---|---|
references/templates/phpunit-xml.md | phpunit.xml + first TestCase |
references/templates/pest-setup.md | Pest.php + first Pest tests |
references/templates/test-doubles.md | Stubs, mocks, fixtures, coverage |
use PHPUnit\Framework\TestCase;
final class GreeterTest extends TestCase
{
public function testGreets(): void
{
$this->assertSame('Hi, Al', (new Greeter)->greet('Al'));
}
}
it('greets', function () {
expect((new Greeter)->greet('Al'))->toBe('Hi, Al');
});
testRejectsExpiredToken), assert one behavior each#[DataProvider] with public static providers for table-driven tests@test / @dataProvider annotations (removed in PHPUnit 12)createStub() resultsreferences/annotations-to-attributes.md (opens in a new tab)references/choosing-framework.md (opens in a new tab)references/pest-4.md (opens in a new tab)references/phpunit-12.md (opens in a new tab)references/templates/pest-setup.md (opens in a new tab)references/templates/phpunit-xml.md (opens in a new tab)references/templates/test-doubles.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/php-ecosystem-referenceUse when picking a non-Laravel PHP tool — Symfony components, API Platform, or Slim — and routing to implementation. Do NOT use for Laravel (laravel-expert)./php-http-psrUse when building framework-agnostic PHP HTTP code — PSR-7/15/17/18 messages, middleware, factories, clients. Do NOT use for Laravel HTTP or Symfony HttpFoundation (not PSR-7)./php-language-modernUse when writing modern non-framework PHP 8.1-8.5 — property hooks, asymmetric visibility, pipe operator, attributes, enums, readonly. Do NOT use for style (php-standards) or Laravel./php-quality-toolingUse when setting up PHPStan, Rector, or PHP-CS-Fixer on a non-Laravel PHP project, incl. CI wiring. Do NOT use for Laravel (Pint/Larastan), tests, or syntax./php-standardsUse when setting up PHP-package autoloading, coding style, or PSR interfaces — PSR-4, PER Coding Style 3.1, composer.json. Do NOT use for syntax or Laravel.npx claudepluginhub fusengine/claude-plugins --plugin fuse-phpOther plugins' skills for the same job