mocking

Installation
SKILL.md

PHPUnit Test Doubles and Mocking

When to use

  • The user wants to test a class in isolation by replacing a collaborator (repository, gateway, clock) with a test double on PHP 8.1+.
  • The user wants a dependency to return a fixed value (or throw) so the unit under test has predictable inputs on PHP 8.1+.
  • The user wants to assert that a method was called on a dependency a certain number of times or with certain arguments on PHP 8.1+.

When NOT to use

  • Do not use this skill when the goal is an integration test that must exercise the real database, HTTP client, or filesystem.
  • Do not use this skill when the unit under test is pure logic with no dependencies to replace.

Core guidance

Installs
1
GitHub Stars
3
First Seen
Jul 3, 2026
mocking — anyorgname/php-skills