symfonytest-doubles-mocking
Create test doubles with PHPUnit mocks and Prophecy for isolated unit testing in Symfony
When & Why to Use This Skill
This Claude skill streamlines the creation of test doubles in Symfony applications using PHPUnit mocks and Prophecy. It enables developers to implement isolated unit testing by efficiently mocking complex dependencies, ensuring high code quality and robust test coverage within the Symfony framework.
Use Cases
- Scenario 1: Mocking external API clients or service dependencies in Symfony services to test business logic in total isolation.
- Scenario 2: Using Prophecy to create expressive and readable object prophecies for complex dependency interactions in unit tests.
- Scenario 3: Isolating Symfony controllers from the database layer by generating PHPUnit mock objects for Doctrine repositories.
- Scenario 4: Refactoring legacy Symfony code by introducing test doubles to break tight coupling and improve overall testability.
| name | symfony:test-doubles-mocking |
|---|---|
| description | Use when symfony test doubles mocking |
symfony:test-doubles-mocking (Micro)
Use when
- Use when symfony test doubles mocking
Rules
- Keep changes minimal and focused
- Ask before running servers/builds/tests
- Load reference/examples only on explicit request
References
reference.mddocs/complexity-tiers.md