スキル一覧に戻る
Dev-Int

create-functional-test

by Dev-Int

Tests for help and skill :wink:

0🍴 0📅 2026年1月16日
GitHubで見るManusで実行

SKILL.md


name: create-functional-test description: 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.

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

InputExampleOutput
controller_classGetArticlesControllerBC/Tests/Adapters/Controller/.../ControllerNameTest.php
route/admin/articles-
methodGET, POST-
fixtures['ArticleFactory' => 5]-

Process

StepAction
CreateUse template: test-functional.php.tpl
Runphp bin/phpunit path/to/Test.php
Validatemake cs-fixer && make stan && make ta

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 repository->save() or $em->flush()

Assertions:

  • HTTP: assertResponseIsSuccessful(), assertResponseRedirects(), assertResponseStatusCodeSame(404)
  • DOM: assertSelectorExists('.class'), assertSelectorTextContains('h1', 'Title'), assertSelectorCount(3, '.item')

CRITICAL:

  • Use $this->client (NOT 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

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です