Claude-skill-registry create-functional-test
Create functional test for HTTP controllers and LiveComponents. Use when testing web endpoints, form submissions, API responses, or LiveComponent interactions. Tests make HTTP requests and verify responses/DOM.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/create-functional-test" ~/.claude/skills/majiayu000-claude-skill-registry-create-functional-test && rm -rf "$T"
manifest:
skills/data/create-functional-test/SKILL.mdsource content
Create Functional Test
Generate functional test for HTTP controllers and LiveComponents.
When to Use
- HTTP endpoints (GET/POST/PUT/DELETE)
- Form submissions
- LiveComponents
- API responses
Inputs/Outputs
| Input | Example | Output |
|---|---|---|
| controller_class | GetArticlesController | |
| route | /admin/articles | - |
| method | GET, POST | - |
| fixtures | ['ArticleFactory' => 5] | - |
Process
| Step | Action |
|---|---|
| Create | Use template: |
| Run | |
| Validate | |
Structure
Functional Test (extends
BaseFunctionalTestCase):
final class ControllerNameTest extends BaseFunctionalTestCase { use Factories; public function testMethodName(): void { // Setup with Foundry (auto-persists) EntityFactory::createOne(['name' => 'Test']); // Request (use $this->client, NOT static::createClient()) $this->client->request('GET', '/route'); // Assertions self::assertResponseIsSuccessful(); self::assertSelectorExists('.element'); } }
See:
docs/GLOSSARY.md#functional-test for detailed definition
Rules
Setup:
- Use Foundry (NOT DataBuilder)
- Foundry auto-persists and commits
- NO manual
orrepository->save()$em->flush()
Assertions:
- HTTP:
,assertResponseIsSuccessful()
,assertResponseRedirects()assertResponseStatusCodeSame(404) - DOM:
,assertSelectorExists('.class')
,assertSelectorTextContains('h1', 'Title')assertSelectorCount(3, '.item')
CRITICAL:
- Use
(NOT$this->client
)static::createClient() - Extends
BaseFunctionalTestCase - Use trait
Factories - Performance: ~550ms/test (DB purge + HTTP request)
Templates
test-functional.php.tpl
Location:
.claude/templates/
References
- Functional test definition:
docs/GLOSSARY.md#functional-test - Testing strategy:
docs/testing.md#functional - Base test case:
src/Shared/Tests/BaseFunctionalTestCase.php