Skip to content
Development
Skill

/tdd-with-phpunit

Apply RED-GREEN-REFACTOR with PHPUnit 10/11 for Symfony; KernelTestCase/WebTestCase, attributes (#[Test]/#[DataProvider]), Foundry

From plugin
superpowers-symfony
23344 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit --agent claude-code

SKILL.md

tdd-with-phpunit.SKILL.md
name: tdd-with-phpunit
description: Apply RED-GREEN-REFACTOR with PHPUnit 10/11 for Symfony; KernelTestCase/WebTestCase, attributes (#[Test]/#[DataProvider]), Foundry
capabilities: [read, search, edit, shell]
tags: [testing, tdd]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash

Tdd With Phpunit (Symfony)

Use when

  • Driving a feature with RED-GREEN-REFACTOR using PHPUnit 10/11 class-based tests.
  • Choosing between `TestCase`, `KernelTestCase` and `WebTestCase` for a new behavior.
  • Testing a console command, or an invalid form that must answer 422.
  • Swapping an external service for a double through the test container.

Default workflow

1. RED: pick the base class, write the test with `#[Test]`, `#[DataProvider]` and `#[CoversClass]`, run it and check it fails for the right reason. 2. GREEN: write the minimum code that passes. 3. REFACTOR with the suite green, re-running it after each change. 4. Replace an external boundary with `static::getContainer()->set(Service::class, $mock)`. 5. Test commands with `CommandTester`, or with `runCommand()` and `assertCommandIsSuccessful()` on Symfony 8.1+. 6. Assert invalid form submissions with `assertResponseIsUnprocessable()`.

Guardrails

  • Use PHPUnit 10+ attributes, not `@test` or `@dataProvider` annotations.
  • Fetch services with `static::getContainer()`, not the legacy `self::$container`.
  • Mock only true external boundaries (HTTP clients, third-party SDKs); keep real services and a real database elsewhere.
  • `runCommand()` and closures in `getContainer()->set()` need Symfony 8.1+.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • The failing PHPUnit output (RED), then the passing run.
  • Test files changed, with the base class and attributes used.
  • Commands executed.

References

  • `reference.md`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

23344 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
233
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about tdd-with-phpunit.

Which coding agents can use tdd-with-phpunit?
tdd-with-phpunit installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.