Skip to main content
skill CX Codex

functional-tests — Claude Code skill: what it does, how to install

functional-tests guides Claude Code in writing functional Symfony tests using WebTestCase, KernelTestCase, loginUser, and DAMA rollback.

MIT ★ 234 updated 2026-10-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill functional-tests -a claude-code
Open on GitHub

What functional-tests does

This skill enforces structured testing standards for Symfony HTTP routes and database-dependent services. It selects WebTestCase for controllers, invokes static::createClient() directly, inspects internal dependencies via static::getContainer(), and bypasses form-based logins by invoking $client->loginUser($user) directly.

Database state is kept isolated using DAMADoctrineTestBundle alongside Foundry fixtures. Mocking the EntityManager or repositories is explicitly prohibited when tests touch data, keeping assertions tied strictly to the actual database engine.

Keep in mind that .env.local is bypassed in test mode, so parameters belong in .env.test or .env.test.local. In addition, form validation failures expect HTTP 422 via assertResponseIsUnprocessable(), while assertSessionHasFlashMessage() requires Symfony 8.1 or higher.

What it helps with

  • generate HTTP controller tests using WebTestCase and DOM assertions
  • verify role-protected endpoints using loginUser
  • isolate integration database state via DAMADoctrineTestBundle
  • build parameterized smoke test suites for hardcoded application URLs

Example prompts for the agent

  • Write a WebTestCase for the checkout endpoint that checks for a redirect and an email dispatch
  • Create functional tests for the profile controller using loginUser and real database records
  • Set up smoke tests with a data provider to verify status codes across public endpoints

How to install functional-tests

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill functional-tests -a claude-code

2Manually: put the files in place

~/.claude/skills/functional-tests/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/functional-tests/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about functional-tests

How to install functional-tests in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill functional-tests -a claude-code in your terminal.

What does the functional-tests skill do?

It equips the agent with guidelines to write Symfony functional tests, covering proper client setup, DOM checks, response validations, and transaction rollbacks.

Which environment files are supported during test runs?

The test runner ignores .env.local, requiring configuration parameters to be placed inside .env.test or .env.test.local.

Source text

SKILL.md · MIT
---
name: functional-tests
description: Write functional tests for Symfony controllers and HTTP endpoints using WebTestCase, getContainer, loginUser, and DAMA rollback
capabilities: [read, search, edit, shell]
tags: [testing]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash
---

# Functional Tests (Symfony)

## Use when
- A controller or HTTP endpoint must be checked through the kernel: status, redirect, rendered DOM, form errors, emails.
- A repository or service must be tested against the real database with `KernelTestCase`.
- An authenticated or role-restricted route needs coverage via `loginUser()`.
- Key URLs need cheap smoke tests.

## Default workflow
1. Choose the base class: `WebTestCase` for HTTP, `KernelTestCase` for services, plain `TestCase` for pure logic.
2. Call `static::createClient()` directly (never `bootKernel()` first) and read private services with `static::getContainer()`.
3. Authenticate with `$client->loginUser($user)` instead of replaying the login form.
4. Assert the response and the DOM: `assertResponseIsSuccessful()`, `assertResponseRedirects()`, `assertSelectorTextContains()`, `assertEmailCount()`.
5. Isolate tests with the DAMADoctrineTestBundle `PHPUnitExtension`, plus Foundry reset for fixtures.
6. Add smoke tests with a data provider and hardcoded URLs.

## Guardrails
- Use the real database and real repositories; do not mock the EntityManager or repositories in data-touching tests.
- Invalid form submissions assert 422 with `assertResponseIsUnprocessable()` (Symfony 8.0+ behavior).
- `.env.local` is not loaded in the test environment: use `.env.test` or `.env.test.local`.
- `assertSessionHasFlashMessage()` requires Symfony 8.1+.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- Test classes with the base class chosen for each.
- The authentication and database isolation strategy.
- Status codes, DOM assertions and smoke URLs covered.

## References
- `reference.md`

© dev-toolings · MIT · dev-toolings/superpowers-symfony

Similar skills

All skills for Testing and QA →

From the same set51

The whole set →
api-platform-serialization Skill configures API Platform serialization: field groups per operation, IRIs instead of nested objects, computed properties, and normalizer options. CX Codex +1 ★ 234repo stars symfony-scheduler Configures recurring tasks with the Symfony Scheduler component without system crontab entries. Useful for scheduled report generation, database cleanups, and Messenger syncs. CX Codex +1 ★ 234repo stars tdd-with-pest tdd-with-pest guides RED-GREEN-REFACTOR in Symfony projects using Pest v4. Use it to write new tests, reproduce bugs before a fix, or move PHPUnit tests to Pest syntax. CX Codex +1 ★ 234repo stars api-platform-versioning api-platform-versioning keeps API Platform clients alive through renames and removals: deprecation with a sunset date first, parallel versions as the last resort. CX Codex +1 ★ 234repo stars doctrine-migrations Create and review Doctrine migrations, prepare rollbacks, and check pending changes before deployment. Useful when a Symfony app’s entity mapping changes. CX Codex +1 ★ 234repo stars symfony-messenger A skill for async message handling with Symfony Messenger: configures transports, handlers, and retry strategies. CX Codex +1 ★ 234repo stars api-platform-security api-platform-security secures API Platform operations with security expressions, voters, and validation-phase access checks in Symfony. CX Codex +1 ★ 234repo stars e2e-panther-playwright The e2e-panther-playwright skill guides Symfony E2E tests with Panther for browser flows and Playwright for more involved cases. Use it when JavaScript behavior is beyond what WebTestCase can observe. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open