functional-tests
Skill2 starsChanged 6 months agoMITView on GitHub
Write Symfony functional tests for non-API HTTP endpoints (server-rendered pages, form submissions, redirects, auth flows) with `WebTestCase` + `BrowserKit` + `DomCrawler` + Foundry — drives RED-GREEN-REFACTOR TDD on controllers, asserts response codes / redirects / form errors / CSRF, exercises authenticated and anonymous clients, integrates with DAMA Doctrine test bundle for transaction rollback per test, and uses ParaTest for parallel execution. Distinct from `gerard:api-platform-tests` (which targets REST / JSON-LD via `ApiTestCase`). Trigger on "WebTestCase", "test a controller", "test a form submission", "redirect after POST", "test CSRF", "convert bug report into a failing test", or "functional test for server-rendered page".
In this repository52 other files it gives its agents.
- api-platform-dto-resourcesSkill
- api-platform-errorsSkill
- api-platform-file-uploadSkill
- api-platform-filtersSkill
- api-platform-identifiersSkill
- api-platform-mcpSkill
- api-platform-mutatorsSkill
- api-platform-openapiSkill
- api-platform-paginationSkill
- api-platform-performanceSkill
- api-platform-resilienceSkill
- api-platform-resourcesSkill
- api-platform-securitySkill
- api-platform-serializationSkill
- api-platform-state-processorsSkill
- api-platform-state-providersSkill
- api-platform-testsSkill
- api-platform-upgradeSkill
- api-platform-userSkill
- api-platform-versioningSkill
- bootstrap-checkSkill
- brainstormingSkill
- config-env-parametersSkill
- controller-cleanupSkill
- cqrs-and-handlersSkill
- daily-workflowSkill
- doctrine-batch-processingSkill
- doctrine-fetch-modesSkill
- doctrine-fixtures-foundrySkill
- doctrine-migrationsSkill
- doctrine-relationsSkill
- doctrine-transactionsSkill
- effective-contextSkill
- executing-plansSkill
- interfaces-and-autowiringSkill
- makefile-disciplineSkill
- messenger-retry-failuresSkill
- ports-and-adaptersSkill
- quality-checksSkill
- rate-limitingSkill
- runner-selectionSkill
- strategy-patternSkill
- symfony-cacheSkill
- symfony-messengerSkill
- symfony-schedulerSkill
- symfony-votersSkill
- tdd-with-pestSkill
- tdd-with-phpunitSkill
- test-doubles-mockingSkill
- using-symfony-superpowersSkill
- value-objects-and-dtosSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
CSRF on by default: If a form omits CSRF in the test, the test should fail.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Functional tests (Symfony — non-API)
Use when
- Writing functional tests for server-rendered controllers (Twig pages, form submissions, admin areas).
- Converting a bug report into a failing test (RED-GREEN-REFACTOR).
- Exercising authentication flows (login form, redirects, access-denied).
- Asserting form validation errors, CSRF, redirects, flash messages.
For REST / JSON-LD endpoints exposed by API Platform, use
gerard:api-platform-testsinstead — it coversApiTestCase, schema assertions, JSON-LD pagination shape, JWT clients, etc.
Default workflow
- RED: write a failing functional test that captures the target behavior.
- GREEN: implement the smallest controller / form change that makes the test green.
- REFACTOR: clean up controller and template while the test stays green.
- Broaden coverage to authorization (anonymous / forbidden / authorized) and error paths.
Guardrails
- Assert observable behavior, not internal state. Status codes, redirects, rendered content, flash messages — not service internals.
- Deterministic fixtures. Foundry factories or
ResetDatabase/ DAMA transaction rollback per test. - No order coupling. Each test starts from a clean state.
- CSRF on by default. If a form omits CSRF in the test, the test should fail.
- Real templates render — don't mock the renderer in functional tests; the goal is the full HTTP stack.
Progressive disclosure
SKILL.mdcovers posture and rules.reference.mdcarries the full patterns: WebTestCase skeleton, login helpers, form submission, redirect assertions, flash messages, CSRF, DAMA setup, scenario-based naming, ParaTest invocation.
Output contract
- A
tests/Functional/<Area>/<Feature>Test.phpextendingWebTestCase. - Tests covering happy path + anonymous + forbidden + invalid form paths.
- DAMA / ResetDatabase guarantees test isolation.
References
reference.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

