testing-strategy

testing-strategy is a skill for Claude Code, Codex from garrettw/php-arch-skills. It costs 46 tokens per session (1,274 once invoked), scanned A, original, MPL-2.0.

A testing guide for PHP applications that matches tests to the part of the system being checked. It distinguishes unit tests for isolated code, integration tests for connected components, and feature tests for complete behavior.

In plain words
What is it for?
Use it when testing domain objects, data mappers, repositories, handlers, or controllers. It provides patterns such as Arrange, Act, Assert and guidance on mocking external boundaries.
Why use it?
It helps avoid brittle tests that check internal details instead of results. It also explains when to use real databases, test doubles, and independent test data.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/garrettw/php-arch-skills/testing-strategy
Any agent
npx skills add garrettw/php-arch-skills --skill testing-strategy
Clone the repo
git clone --depth 1 https://github.com/garrettw/php-arch-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-strategy

README.md
[![agentmods](https://agentmods.dev/badge/skills/garrettw/php-arch-skills/testing-strategy.svg)](https://agentmods.dev/skills/garrettw/php-arch-skills/testing-strategy)
Your own site
<a href="https://agentmods.dev/skills/garrettw/php-arch-skills/testing-strategy"><img src="https://agentmods.dev/badge/skills/garrettw/php-arch-skills/testing-strategy.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,274 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00046 $0.01274
Opus 5 $0.00023 $0.00637
Sonnet 5 $0.00009 $0.00255
Haiku 4.5 $0.00005 $0.00127

Measured 5d ago against content hash f33e12c2eb49, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing-strategy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/testing-strategy/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend Testing Strategy by Architecture Layer

System Overview

Different architectural layers have different responsibilities, and tests should be structured to verify those specific responsibilities without over-specifying internal implementation details. This skill provides rules for matching the right testing style (unit, integration, feature) to the correct layer.

Principles Behind Good Tests

  • Arrange, Act, Assert (AAA). One logical flow per test: set up the scenario, perform the one action under test, assert the outcome. Keep the "Given" visibly in the test body.
  • Isolation. Each test owns its data and runs independently of others, in any order. No shared mutable state, no order dependence. Deterministic tests are the only ones worth having.
  • Mock only at boundaries. Replace slow or non-deterministic collaborators (databases, HTTP, queues) with doubles. Do not mock the database inside a repository test (test the repository against a real test DB) and do not mock the very object under test. Mocking everything while asserting on call order verifies the implementation, not the behavior — a brittle test that breaks on every refactor.
  • Assert behavior, not internals. Assert on the resulting state, returned value, or recorded events — not on private methods or the exact internal call sequence. A test that survives a legitimate refactor is a test worth keeping.
  • Coverage is a guide, not a target. Aim for meaningful coverage of business logic and unhappy paths; 100% is not the goal and can incentivize worthless assertions.

See clean-code-foundations.md for the encapsulation/DRY lenses that apply here.

Numbered Workflows

1. Testing the Domain Layer

If testing pure domain logic (entities, value objects, policies):

  1. Use pure PHP unit tests. Do not boot the framework or database.
  2. Setup state. Instantiate the object directly using new (the "Given").
  3. Execute behavior. Call the domain method (the "When").
  4. Assert outcomes. Verify the new state, the returned result, or the events recorded (the "Then").

Read the full file on GitHub · 70 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 70 lines · 46 tokens per session scan A f33e12c2eb49

Subscribe to this mod's changes

testing-strategy is a skill published in the GitHub repository garrettw/php-arch-skills (11 stars, last pushed 1mo ago), licensed MPL-2.0. It adds 46 tokens to every session and 1,274 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.