phpunit-unit-test-generation

phpunit-unit-test-generation is a skill for Claude Code from shopwareLabs/ai-coding-tools. It costs 30 tokens per session (2,266 once invoked), scanned A, original, MIT.

An internal workflow for generating PHPUnit unit tests for Shopware PHP code. PHPUnit is a tool that runs automated tests, while unit tests check individual classes or small pieces of code.

In plain words
What is it for?
Use it to analyze a PHP class, decide whether it needs unit tests, create tests in tests/unit, and validate them with PHPStan and PHPUnit.
Why use it?
It helps create tests that follow the project's rules and pass its static checks and test runner. It also avoids changing source code or out-of-scope test folders.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: agent in frontmatter.

Part of the test-writing plugin — 11 skills, 3 agents shipped together

Good fit Use it to analyze a PHP class, decide whether it needs unit tests, create tests in tests/unit, and validate them with PHPStan and PHPUnit.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add shopwareLabs/ai-coding-tools --skill phpunit-unit-test-generation
Clone the repo
git clone --depth 1 https://github.com/shopwareLabs/ai-coding-tools

Made for: Claude Code.

Or install test-writing, the plugin that ships this one along with the rest of its 11 skills, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for phpunit-unit-test-generation

README.md
[![agentmods](https://agentmods.dev/badge/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation/github.svg)](https://agentmods.dev/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation)
Your own site
<a href="https://agentmods.dev/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation"><img src="https://agentmods.dev/badge/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for phpunit-unit-test-generation

Your own site · 80×15
<a href="https://agentmods.dev/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation"><img src="https://agentmods.dev/badge/skills/shopwarelabs/ai-coding-tools/phpunit-unit-test-generation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,266 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.02266
Opus 5.5 $0.00012 $0.00906
Sonnet 5.5 $0.00006 $0.00453
Haiku 4.5 $0.00003 $0.00227

Measured 2mo ago against content hash 1b52ba6fcdb1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

phpunit-unit-test-generation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/test-writing/skills/phpunit-unit-test-generation/SKILL.md · 261 lines

How it starts

The opening of the file, as written. The whole thing — 261 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PHPUnit Test Generation

Generate Shopware-compliant PHPUnit unit tests that pass PHPStan and PHPUnit validation.

File Write Restrictions

Write ONLY to:

  • tests/unit/** - Unit test files

NEVER write to:

  • src/** - Source code (read-only)
  • tests/integration/** - Out of scope
  • Any other directory

Quick Start

  1. Read the target source class
  2. Check if test is required (see Phase 1)
  3. Determine test category (A-E)
  4. Apply the matching template
  5. Validate with PHPStan and PHPUnit
  6. Fix any errors and repeat
  7. Generate completion report

Phase 1: Analyze Source Class

Step 1: Check Coverage Exclusions

Before analyzing the source class, check if the project's phpunit.xml.dist (or phpunit.xml) excludes it from coverage. Files excluded from coverage do not need unit tests.

  1. Read phpunit.xml.dist from the project root
  2. Find <exclude> rules inside the <coverage> or <source> section
  3. Match the source file path against each rule:
    • <directory suffix="X">path</directory> — excluded if file is under path AND filename ends with X
    • <file>path/to/File.php</file> — excluded if relative path matches exactly
  4. If excluded → Return SKIPPED with skip_type: coverage_excluded and reason: "Source file excluded from coverage by phpunit.xml.dist (<matched-rule>)"

If phpunit.xml.dist is not found, skip this step.

Step 2: Determine If Test Is Required

Before generating any test, evaluate if the class/method requires one.

Quick check: Does the method body contain ONLY return <literal|constant|property|passthrough-new|delegation>?

  • Yes -> NO TEST NEEDED — Return SKIPPED with skip_type: no_logic and reason describing the pattern (e.g., "Pure accessor - no logic to test")
  • No (has conditionals/loops/transformations) -> Continue to Step 3

For detailed rules on what to test vs skip, see references/test-requirement-rules.md.

Step 3: Analyze Source Structure

Read the target class to determine:

  1. Public methods - What behaviors to test
  2. Constructor dependencies - What to mock/stub
  3. Return types - Expected outcomes
  4. Exception scenarios - Error paths (see references/exception-patterns.md)
  5. Deprecation markers - @deprecated tags, Feature::triggerDeprecationOrThrow(), Feature::silent(), Feature::callSilentIfInactive() (see references/deprecation-guards.md)
  6. Package attribute - the #[Package('...')] value the covered class carries. The test class carries the same value. When the covered class carries none, take the value from the nearest src/ directory the test path mirrors, walking up until one exists and using the value its .php files carry. When that yields no value, emit no #[Package] and report that in the Phase 5 report's Package field (none, per references/output-format.md) rather than guessing a value.

Read the full file on GitHub · 261 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed 1b52ba6fcdb1
  2. 2mo ago Changed 52c8f8f42409
  3. 2mo ago Changed 81ef16c58826
  4. 2mo ago Changed · +2 lines 7ad0ae08db93
  5. 3mo ago First seen · 259 lines · 30 tokens per session scan A d755d66d7bad

Subscribe to this mod's changes

phpunit-unit-test-generation is a skill published in the GitHub repository shopwareLabs/ai-coding-tools (48 stars, last pushed 13d ago), licensed MIT. It adds 30 tokens to every session and 2,266 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

phpunit-unit-test-generation compared with skills from other repositories

phpunit-unit-test-generation next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
phpunit-unit-test-generationshopwareLabs/ai-coding-toolsSkill4813d agoMITA30Claude Code
generate-file-name-gatemelodic-software/claude-code-pluginsSkill33todayMITA87Claude Code
test-structural-invariantsjimmc414/claude-code-plugin-marketplaceSkill4yesterdayMITA27Claude Code
test-with-examplesjimmc414/claude-code-plugin-marketplaceSkill4yesterdayMITA23Claude Code
verify-solution-propertiesjimmc414/claude-code-plugin-marketplaceSkill4yesterdayMITA23Claude Code
verify-with-inline-testsjimmc414/claude-code-plugin-marketplaceSkill4yesterdayMITA27Claude Code
releaseNikiforovAll/claude-code-marketplaceSkill222d agoMITA63Claude Code