Move the API test suite off Behat to PHPUnit
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
調査の方向性
Start by reading CLAUDE.md and the testing configuration, then inventory the 69 feature files, 12 contexts, and their step definitions. The first step is to agree on the PHPUnit setup and porting guide with Daniel, then pilot the health and purge endpoint features with coverage, mutation, and behavior equivalence checks. Done means all scenarios are ported or deliberately dropped with reasons, Behat and its dependencies are removed, and the Symfony 8 functional suite runs.
索引モデルが issue の本文から書いたものです。
説明
Why
- Symfony 8 is untested.
behat/behat3 andfriends-of-behat/mink-extension2 cap six Symfony components at^7.0, so every Behat leg runs the test app on Symfony 7.4's framework, the ones named 8.1 included. The bundle claims Symfony 8 support that its API tests never exercise. - It depends on a fork. behatch/contexts is abandoned upstream; we depend on a fork. That fork pins
justinrainbow/json-schema ^5, which is why Infection can't be a Composer dependency, and it needs theno-apirepository workaround. Behat 4 waits on mink-extension 3 and the fork. - Mutation testing is blind to it. Infection scores only PHPUnit, so code reached only by Behat gets no mutation scrutiny, and every PR adds unit tests for the gate alone.
- It runs without debug. The Behat app runs
debug: false. The alpha.29 stopwatch 500 (#501) was invisible to it; the template's PHPUnit suite caught it. - API Platform left it. API Platform, the reason we adopted Behat, moved its own suite to PHPUnit's
ApiTestCase.
Scale: 69 feature files, about 1078 scenarios, 12 contexts, about 9,850 lines of context code.
Goals
- Every Behat scenario is ported to PHPUnit, or deliberately dropped with a reason. Behat, Mink and behatch are removed.
- The tests read as well as the scenarios did: the test method name carries the behaviour (CLAUDE.md already says the reason belongs in the test name), with a small helper vocabulary.
- A clear structure: unit tests stay small and isolated; functional tests describe behaviour through HTTP and console, in terms we can state and check.
- Every ported area proves it catches what the old scenarios caught (see Equivalence).
- At the end, two lists:
- scenarios whose intent or result we're unsure of;
- behaviour we should be testing and aren't.
Phase 1: choose and set up the replacement (with Daniel, before any porting)
Decide and write down, in CLAUDE.md and a porting guide:
- Framework: API Platform's
ApiTestCase(its HTTP client, JSON and JSON-schema assertions) for API behaviour, andKernelTestCasewithCommandTesterfor console commands. - Kernels in PHPUnit. CLAUDE.md forbids booting a kernel in PHPUnit today: a debug boot registers Symfony's ErrorHandler, PHPUnit reports Risky, and Infection's initial run fails. Choose:
- a separate functional suite that Infection doesn't run; or
- solve it (e.g.
debug: falsefor most tests, plus a debug-kernel suite for stopwatch and profiler behaviour). Prove the choice in the pilot.
- Structure and naming: e.g.
tests/Unit/<Area>andtests/Functional/<Area>mirroring the feature areas, one test class per feature, andtest_<behaviour>names. - Helpers: replace the contexts with traits or fixtures: login as admin or user, Doctrine fixtures, profiler, purged tags, Mercure messages, cookies, console runs, the static test doubles. List each step definition and its replacement.
- Running: keep per-process isolation for parallel runs, as
BEHAT_SHARDdoes now (AppKernel::shardSuffix()), plus coverage and Codecov uploads, and Infection's view of the new tests. - Pilot: port two small features end to end, e.g.
health.featureand the purge endpoints, with the equivalence check below. Daniel reviews the result as the template every later port follows.
Phase 2: port as a team
Once Phase 1 is agreed:
- Work units: one feature file each, grouped into areas with a lead per area (
mainsplit by topic,user,fixtures,uploads,publishableand the rest), under one coordinator. - The coordinator keeps a tracker, assigns areas, merges in order, and resolves shared-helper changes.
- Each port is one PR that:
- adds the PHPUnit tests and deletes the scenarios it replaces;
- passes the equivalence check;
- lists anything the porter was unsure of.
- Leads review their area's PRs against the porting guide before the coordinator merges. Daniel approves the guide and samples PRs, and doesn't need to review every one.
Equivalence: the new tests catch what the old ones caught
For each ported feature:
- Coverage. Record the old scenarios' line coverage (per-feature clover from
CoverageContext) and require the new tests to cover at least those lines ofsrc/. Any shortfall is listed and explained. - Mutation. Run Infection with the new tests over the lines the old feature covered. Surviving mutants are fixed or listed. This is the gate Behat never had.
- Behaviour. Every assertion the scenarios made has a counterpart; the PR maps scenarios to tests.
Phase 3: finish
- Remove Behat, Mink, the behatch fork, the
no-apirepository andbin/behat-parallel; move CI to PHPUnit suites; update CLAUDE.md's testing section. - Lift the Symfony 7.4 test pin and run the functional suite on Symfony 8.
- Publish the two lists (unsure results; missing behaviour) as follow-up issues.
- 主要言語
- PHP
- スター
- 32
- フォーク
- 8
- 平均マージ
- 1時間 1分
- マージ済み PR(30日)
- 159
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
components-web-app/api-components-bundle のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
components-web-app/api-components-bundle#333 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#325 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
components-web-app/api-components-bundle#259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#186 ·
メンテナーはふだん 1 日以内に返信
components-web-app/api-components-bundle の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Spomky-Labs/pwa-bundle#476 ·
-
domain/discovery
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
neos/flow-development-collection#3639 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
The PHP version check in prepare.php still allows PHP 7.2 and 7.3対応中かも @ekamran が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
WordPress/phpunit-test-runner#359 ·
メンテナーはふだん 2 日以内に返信