php-testing

php-testing is a skill for Claude Code from OrcaQubits/agentic-commerce-skills-plugins. It costs 43 tokens per session (1,048 once invoked), scanned A, original, MIT.

A guide to testing PHP code with PHPUnit, a tool that runs checks against PHP programs. It covers unit tests, which test small pieces of code, along with test doubles, assertions, and data providers.

In plain words
What is it for?
Use it to write PHPUnit tests, verify returned values and errors, replace dependencies with mocks, and develop with TDD, a process of writing tests before implementation.
Why use it?
It helps you check code behavior automatically and test several inputs without repeating the same test structure.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the magento2-commerce plugin — 19 skills, 1 agent shipped together

Good fit Use it to write PHPUnit tests, verify returned values and errors, replace dependencies with mocks, and develop with TDD, a process of writing tests before implementation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/orcaqubits/agentic-commerce-skills-plugins/php-testing
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.

Any agent
npx skills add OrcaQubits/agentic-commerce-skills-plugins --skill php-testing
Clone the repo
git clone --depth 1 https://github.com/OrcaQubits/agentic-commerce-skills-plugins

Made for: Claude Code.

Or install magento2-commerce, the plugin that ships this one along with the rest of its 19 skills, 1 agent.

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 php-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing/github.svg)](https://agentmods.dev/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing)
Your own site
<a href="https://agentmods.dev/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing"><img src="https://agentmods.dev/badge/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for php-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing"><img src="https://agentmods.dev/badge/skills/orcaqubits/agentic-commerce-skills-plugins/php-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,048 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00043 $0.01048
Opus 5 $0.00022 $0.00524
Sonnet 5 $0.00009 $0.00210
Haiku 4.5 $0.00004 $0.00105

Measured 3d ago against content hash c8c08c5e53bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-17, from the pricing page.

Security

Grade A, and why

php-testing 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 3d 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.

magento2-commerce/skills/php-testing/SKILL.md · 129 lines

How it starts

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

PHP Testing with PHPUnit

Before writing code

Fetch live docs: Web-search site:docs.phpunit.de phpunit 10 (or current version) for the latest PHPUnit documentation. Check https://phpunit.de/ for current version.

PHPUnit Fundamentals

Test Class Structure

  • Test classes extend PHPUnit\Framework\TestCase
  • Test methods prefixed with test or annotated #[Test]
  • setUp() — runs before each test
  • tearDown() — runs after each test
  • setUpBeforeClass() / tearDownAfterClass() — per-class lifecycle

Assertions

Common assertions:

  • assertEquals($expected, $actual) — loose comparison
  • assertSame($expected, $actual) — strict comparison (type + value)
  • assertTrue($value) / assertFalse($value)
  • assertNull($value) / assertNotNull($value)
  • assertInstanceOf($class, $object)
  • assertCount($count, $array)
  • assertArrayHasKey($key, $array)
  • assertStringContainsString($needle, $haystack)
  • expectException($class) — exception testing

Data Providers

Supply multiple test cases to a single test method:

  • #[DataProvider('providerName')] attribute (PHPUnit 10+)
  • Provider method returns array of arrays (each inner array = one test case)
  • Reduces test duplication for parameterized testing

Test Doubles

Mocks

Verify behavior — assert that methods were called with expected arguments:

  • $this->createMock(SomeClass::class)
  • $mock->expects($this->once())->method('save')->with($entity)
  • $mock->expects($this->never())->method('delete')

Stubs

Provide canned responses — no behavior verification:

  • $stub->method('getById')->willReturn($entity)
  • $stub->method('getList')->willReturn($searchResults)

Method Return Behaviors

  • willReturn($value) — always returns this value
  • willReturnMap($map) — returns based on argument mapping
  • willReturnCallback($callable) — dynamic return
  • willThrowException($exception) — throws on call
  • willReturnSelf() — returns the mock (for fluent APIs)

Consecutive Calls

Read the full file on GitHub · 129 lines

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. 3d ago First seen · 129 lines · 43 tokens per session scan A c8c08c5e53bb

Subscribe to this mod's changes

php-testing is a skill published in the GitHub repository OrcaQubits/agentic-commerce-skills-plugins (39 stars, last pushed 3d ago), licensed MIT. It adds 43 tokens to every session and 1,048 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-09-15.

Related

Other skills, from other repositories

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

phpunit-unit-test-reviewing

Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.

shopwareLabs/ai-coding-tools · 31 tokens

phpunit-unit-test-writing

Use this skill when the user asks to write, generate, create, or add PHPUnit unit tests for a Shopware 6 source class — phrases like "write unit tests for X", "generate tests for ClassName", "create PHPUnit tests", "add test coverage", "test this class", "cover this with tests", "I need tests for", "unit test this"…

shopwareLabs/ai-coding-tools · 187 tokens

laravel-testing

Laravel 13 testing with Pest PHP 4 or PHPUnit 12. Use when writing feature tests, unit tests, or any test code in a Laravel application. Triggers on tasks involving HTTP tests, model factories, database assertions, mocking facades, authentication testing, or test organisation patterns.

AsyrafHussin/agent-skills · 62 tokens

archestra-dev-testing

Use when deciding whether a change needs a test and at which level — unit, backend route-level integration, MSW-backed frontend integration, or e2e — or when reviewing tests for the "fluff test" anti-pattern. Start here before archestra-dev-backend-tests or archestra-dev-e2e.

archestra-ai/archestra · 68 tokens

archestra-dev-backend-tests

Use when writing or modifying Archestra backend unit tests (platform/backend/src//.test.ts) — mocking modules, stubbing globals, database fixtures, vitest projects/isolation, or test performance.

archestra-ai/archestra · 46 tokens