testing-phpunit
CommunityShip Magento PHPUnit tests with confidence.
Authorcaravanglory
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill removes the guesswork from writing isolated Magento 2 unit tests by showing how to test real classes with mocked dependencies, precise assertions, and clear exception handling.
Core Features & Use Cases
- Behavior-focused unit testing: Covers service logic, return values, state changes, and collaborator side effects without full framework bootstrap.
- Mocking and setup patterns: Explains how to build subjects in setUp, configure direct constructor dependencies, and avoid over-mocking.
- Data-driven coverage: Uses data providers to validate repeated input and output combinations, including edge cases and invalid inputs.
- Exception verification: Demonstrates how to assert Magento and PHP exceptions with expected messages.
- Use case: A Magento developer can quickly create or update Test/Unit classes for a model or service and verify logic before shipping a module change.
Quick Start
Ask the skill to write or update a Magento 2 PHPUnit unit test for a specific class, its dependencies, and the behaviors or exceptions you want covered.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: testing-phpunit Download link: https://github.com/caravanglory/magehub/archive/main.zip#testing-phpunit Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.