/test-writing:phpunit-migration-test-generationfrom test-writing
Generates PHPUnit migration tests for Shopware 6 migration classes by analyzing SQL operations and applying appropriate test patterns (schema-add, schema-remove, data-update, config, mail template). Validates against PHPStan and PHPUnit.
Ships in test-writing. 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.
Generate Shopware-compliant PHPUnit migration tests that pass PHPStan and PHPUnit validation.
Write ONLY to:
tests/migration/** — Migration test filesNEVER write to:
src/** — Source code (read-only)tests/unit/** — Unit tests (out of scope)tests/integration/** — Integration tests (out of scope)Migration/V6_Shopware\Core\Framework\Migration\MigrationStepIf validation fails, return FAILED with reason.
Read the migration class and extract information needed for test generation. See references/source-analysis.md for detection patterns.
getCreationTimestamp() return value#[Package('...')] attribute value — the test class carries the same value. When the migration 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.Core, Administration, Storefront, Elasticsearch)V6_6, V6_7, V6_8)Read update() and updateDestructive() method bodies. Classify:
A migration may contain multiple patterns (e.g., schema-add + data-update).
Determine if updateDestructive() has logic:
parent::updateDestructive() → no logicBased on detected patterns, select traits per references/source-analysis.md trait selection table.
Mirror source path:
src/Core/Migration/V6_7/Migration1234Foo.php → tests/migration/Core/V6_7/Migration1234FooTest.phpsrc/Administration/Migration/V6_7/Migration1234Bar.php → tests/migration/Administration/V6_7/Migration1234BarTest.phpUse the migration test template at templates/migration-test.md. Include conditional sections based on Phase 2 analysis:
Fill all placeholders using Phase 2 metadata.
Write to the path determined in Step 1.
- [ ] PHPStan passes (0 errors)
- [ ] PHPUnit passes (all tests green)
- [ ] ECS passes (code style)
{
"paths": ["tests/migration/Path/To/GeneratedTest.php"],
"error_format": "json"
}
Common migration test errors:
TableHelper, KernelLifecycleManager, Uuid, DefaultsConnection{
"paths": ["tests/migration/Path/To/GeneratedTest.php"],
"output_format": "result-only"
}
If tests fail, re-run without output_format to get failure details.
Common migration test failures:
Check for violations, then apply fixes if needed.
Loop Steps 1-5 until all validations pass. Maximum 3 iterations — after that, proceed to Phase 5 with status PARTIAL.
For output format and examples, see references/output-format.md.
| Condition | Status |
|---|---|
| All validations pass | SUCCESS |
| Test generated, validation issues remain after 3 iterations | PARTIAL |
| Invalid input | FAILED |
What SKILL.md sets; muted values are Claude Code's defaults
test-writing:test-generator), in the backgroundThree short reads, in order
npx claudepluginhub shopwarelabs/ai-coding-tools --plugin test-writing11 skills in this plugin
/phpunit-integration-test-generationUse this skill when the user asks to generate, write, or create integration tests for a Shopware 6 source class whose contract requires wired-up code — phrases like "generate integration tests for X", "write an integration test for this controller", "test this indexer", "create an integration test for the message handler". Detects supported integration patterns (controller/route, scheduled-task, message-handler, indexer, DAL-persistence flow, multi-service coordinator) and applies a template producing an INTEGRATION-001..008-compliant test using IntegrationTestBehaviour against the real DAL, container, and HTTP/messaging. When the source class is unit-shape (no persistence, no kernel state, no wiring under test), returns SKIPPED and points at phpunit-unit-test-writing. Do NOT activate for unit tests or migration tests (use phpunit-migration-test-generation)./phpunit-integration-test-reviewingInternal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent./phpunit-integration-to-unit-migratingUse this skill ONLY when the user explicitly requests an audit, migration, or evaluation of whether a Shopware integration test belongs in the unit suite — trigger phrases like "audit integration tests", "migrate integration tests to unit", "is this an integration test or a unit test", "evaluate integration tests for migration", "should this be a unit test instead". Audits tests under tests/integration/ for misplacement and migrates load-bearing-free tests to tests/unit/ using one of six codified refactoring patterns. NOT invoked automatically by reviewing skills — phpunit-integration-test-reviewing emits a placement smoke-alarm hint pointing here, but the user must invoke this skill explicitly to run the deep audit./phpunit-migration-test-reviewingInternal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent./phpunit-test-adversarial-reviewingInternal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent./phpunit-test-reconcilingInternal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.Other plugins' skills for the same job