PHPUnit family — version router
Use this family for PHPUnit 9, 10, and 11 work. Resolve one version first,
then read exactly that selector reference; conditional references keep unrelated
version guidance out of context.
Resolution contract
- If the caller supplies 9, 10, or 11, use that selector without reading
project files or dhpk manifests.
- Otherwise inspect the current project's composer.lock (installed
phpunit/phpunit version) and then composer.json (require and require-dev).
Select a single resolvable major.
- If no supported major is detected, ask which version applies. Do not guess,
default to the newest reference, or use distribution/install manifests.
The family-local resolver and portable CLI implement this contract:
node scripts/resolve-version.js --json [--version 9|10|11]
The JSON result reports status, family, selector, source, reference,
loadedReferences, and the selected guidance. An unresolved result reports
status "ask", no reference loaded, and an actionable question.
Version branches
- 9 — PHPUnit 8.5/9.x lifecycle signatures, assertions, providers, mocks,
hooks, risky-test checks, and the complete API migration catalog:
references/9.md.
- 10 — PHP 8.1 floor, attributes preferred while doc-comment metadata still
works, runner/configuration changes, hooks, and the 9 → 10 checklist:
references/10.md.
- 11 — PHP 8.2 floor, attribute-first migration, deprecated doc-comment
metadata, typed overrides, discovery, and the 10 → 11 checklist:
references/11.md.
The lifecycle authority is explicit: PHPUnit 10 supports attributes and still
reads doc-comment metadata (attributes take precedence); PHPUnit 11 deprecates
doc-comment metadata; PHPUnit 12 removes test annotations, while
@codeCoverageIgnore, @codeCoverageIgnoreStart, and @codeCoverageIgnoreEnd
remain supported.
When NOT to Use
- Use
php for Laravel routing and general PHP runtime
family selection.
- For PHPUnit 5, 6, or 7-only suites, use PHP 5.6-compatible test guidance
instead of this modern family.
- For everyday assertion writing without a version decision, use focused
test-design guidance rather than loading a version reference.
Shared test discipline
Keep setUp(), tearDown(), and static lifecycle methods compatible with the
selected framework signature. Register expectException*() immediately before
the throwing call, prefer strict assertIs*() assertions, use static named data
providers, and default to createMock(). Treat every non-empty migration scan as
an explicit TODO; enable strict risky-test checks without deleting meaningful
assertions.
Output and verification
Return the selected version boundary, applicable reference, a focused migration
or implementation recommendation, and evidence from the focused test and
relevant suite. For migration work, list every remaining scan match as a TODO
and state the PHP/PHPUnit floor. For a copied family directory, run the
family-local CLI with NODE_PATH empty and an explicit selector.
The family-local scripts/resolve-version.js is the JSON CLI entrypoint. It
accepts an optional explicit selector and exits non-zero when resolution asks
for input or encounters an error. scripts/version-resolver.js is the
programmatic resolver used by the CLI and returns the selected reference,
loaded contents, or an ask result with no loaded references.
1---2name: phpunit3description: 'Use when writing, reviewing, or migrating PHPUnit 9, 10, or 11 tests, resolving a project version, or choosing assertion, metadata, provider, mock, hook, runner, or coverage APIs. Not for PHPUnit 5/6/7-only suites, everyday assertion writing without a version decision, or Laravel routing. Output: selected version boundary, applicable reference, migration guidance, and verification evidence.'4metadata:5 source: https://skillmd.com/skills/hmj1026/phpunit6 dhpk-capability-id: dhpk.skill.phpunit7 dhpk-name-style: portable-family8 dhpk-invocation-class: implicit-eligible9---1011# PHPUnit family — version router1213Use this family for PHPUnit 9, 10, and 11 work. Resolve one version first,14then read exactly that selector reference; conditional references keep unrelated15version guidance out of context.1617## Resolution contract18191. If the caller supplies 9, 10, or 11, use that selector without reading20 project files or dhpk manifests.212. Otherwise inspect the current project's composer.lock (installed22 phpunit/phpunit version) and then composer.json (require and require-dev).23 Select a single resolvable major.243. If no supported major is detected, ask which version applies. Do not guess,25 default to the newest reference, or use distribution/install manifests.2627The family-local resolver and portable CLI implement this contract:2829 node scripts/resolve-version.js --json [--version 9|10|11]3031The JSON result reports status, family, selector, source, reference,32loadedReferences, and the selected guidance. An unresolved result reports33status "ask", no reference loaded, and an actionable question.3435## Version branches3637- 9 — PHPUnit 8.5/9.x lifecycle signatures, assertions, providers, mocks,38 hooks, risky-test checks, and the complete API migration catalog:39 references/9.md.40- 10 — PHP 8.1 floor, attributes preferred while doc-comment metadata still41 works, runner/configuration changes, hooks, and the 9 → 10 checklist:42 references/10.md.43- 11 — PHP 8.2 floor, attribute-first migration, deprecated doc-comment44 metadata, typed overrides, discovery, and the 10 → 11 checklist:45 references/11.md.4647The lifecycle authority is explicit: PHPUnit 10 supports attributes and still48reads doc-comment metadata (attributes take precedence); PHPUnit 11 deprecates49doc-comment metadata; PHPUnit 12 removes test annotations, while50@codeCoverageIgnore, @codeCoverageIgnoreStart, and @codeCoverageIgnoreEnd51remain supported.5253## When NOT to Use5455- Use `php` for Laravel routing and general PHP runtime56 family selection.57- For PHPUnit 5, 6, or 7-only suites, use PHP 5.6-compatible test guidance58 instead of this modern family.59- For everyday assertion writing without a version decision, use focused60 test-design guidance rather than loading a version reference.6162## Shared test discipline6364Keep setUp(), tearDown(), and static lifecycle methods compatible with the65selected framework signature. Register expectException*() immediately before66the throwing call, prefer strict assertIs*() assertions, use static named data67providers, and default to createMock(). Treat every non-empty migration scan as68an explicit TODO; enable strict risky-test checks without deleting meaningful69assertions.7071## Output and verification7273Return the selected version boundary, applicable reference, a focused migration74or implementation recommendation, and evidence from the focused test and75relevant suite. For migration work, list every remaining scan match as a TODO76and state the PHP/PHPUnit floor. For a copied family directory, run the77family-local CLI with NODE_PATH empty and an explicit selector.7879The family-local `scripts/resolve-version.js` is the JSON CLI entrypoint. It80accepts an optional explicit selector and exits non-zero when resolution asks81for input or encounters an error. `scripts/version-resolver.js` is the82programmatic resolver used by the CLI and returns the selected reference,83loaded contents, or an ask result with no loaded references.