home / skills / makfly / superpowers-symfony / test-doubles-mocking
This skill helps you drive Symfony test doubles mocking with deterministic tests, safeguarding regression coverage across fail and pass paths.
npx playbooks add skill makfly/superpowers-symfony --skill test-doubles-mockingReview the files below or copy the command above to add this skill to your agents.
---
name: symfony:test-doubles-mocking
allowed-tools:
- Read
- Glob
- Grep
description: Drive Symfony delivery with deterministic tests and strong regression protection. Use for test doubles mocking tasks.
---
# Test Doubles Mocking (Symfony)
## Use when
- Building regression-safe behavior with TDD/functional/e2e tests.
- Converting bug reports into executable failing tests.
## Default workflow
1. Write failing test for target behavior and one boundary case.
2. Implement minimal code to pass.
2. Refactor while preserving green suite.
2. Broaden coverage for invalid/unauthorized/not-found paths.
## Guardrails
- Prefer deterministic fixtures/builders.
- Assert observable behavior, not internal implementation.
- Keep tests isolated and stable in CI.
## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
## Output contract
- RED/GREEN/REFACTOR trace.
- Test files changed and executed commands.
- Coverage and confidence notes.
## References
- `reference.md`
- `docs/complexity-tiers.md`
This skill helps teams drive Symfony delivery with deterministic tests and strong regression protection by focusing on test doubles and mocking. It guides a RED/GREEN/REFACTOR workflow that produces repeatable, isolated tests and clear change traces. The skill emphasizes observable behavior, stable CI results, and incremental coverage expansion.
It inspects test plans and existing suites to recommend and apply test doubles, mocks, and deterministic fixtures that reduce flakiness. The skill generates the failing test, suggests minimal implementation changes to get green, then advises safe refactors and broader coverage for edge cases. Outputs include a RED/GREEN/REFACTOR trace, list of changed test files and executed commands, and notes on coverage and confidence.
What does the RED/GREEN/REFACTOR trace include?
A concise record showing the failing test(s) introduced, commands run to execute them, the minimal code changes to pass, and any refactoring steps taken.
How do I keep mocks from coupling tests to implementation?
Mock only external interactions and assert public observable behavior. Favor fixtures and builders that express intent rather than mocking internal methods.