Skip to content

Removed 'behat.yml' and 'behat.dist.yml' so Behat 3 and Behat 4 both run the suite from 'behat.php'. - #142

Merged
AlexSkrypnyk merged 3 commits into
mainfrom
feature/remove-behat-yml
Sep 17, 2026
Merged

AlexSkrypnyk merged 3 commits into
mainfrom
feature/remove-behat-yml

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Behat 3 and Behat 4 now both run the suite from behat.php, and behat.dist.php is the only reference configuration the package ships. behat.yml and behat.dist.yml are gone.

Behat 3's ApplicationFactory::getConfigPath() checks behat.yaml, behat.yml, behat.yaml.dist, behat.yml.dist, behat.dist.yaml and behat.dist.yml before it looks at behat.php, so the Behat 3 jobs ran behat.yml while the Behat 4 jobs ran behat.php, and every suite change had to land in both files. Deleting only behat.yml wouldn't have worked: Behat 3 would then have loaded behat.dist.yml, whose ApiServerContext webroot is a vendor/ path that doesn't exist in this repo.

On Behat 3, the run from behat.php matches the old run from behat.yml (17 scenarios, 181 steps, 54.24% Behat line coverage), and Behat 4 gives the same numbers. BehatConfigTest::testNoYamlConfig() now fails if any of those 6 YAML names shows up at the repo root. The CI workflow, composer.json and the Behat version floors don't change, and consumers can keep using a behat.yml on Behat 3.

Before / After

BEFORE

  ┌─────────┐      ┌────────────────┐
  │ Behat 3 │ ───▶ │ behat.yml      │ ─┐
  └─────────┘      └────────────────┘  │  same suite, edited
  ┌─────────┐      ┌────────────────┐  │  in both files
  │ Behat 4 │ ───▶ │ behat.php      │ ─┘
  └─────────┘      └────────────────┘

  Reference:  behat.dist.yml, behat.dist.php
  Test:       BehatDistConfigTest (the 2 files must match)

AFTER

  ┌─────────┐
  │ Behat 3 │ ───┐
  └─────────┘    │     ┌────────────────┐
                 ├───▶ │ behat.php      │
  ┌─────────┐    │     └────────────────┘
  │ Behat 4 │ ───┘
  └─────────┘

  Reference:  behat.dist.php
  Test:       BehatConfigTest (no YAML config at the root,
              every constructor option set in behat.dist.php)

Changes

  • Configuration: Deleted behat.yml and behat.dist.yml, and dropped /behat.yml from .gitattributes.
  • Config test: Renamed BehatDistConfigTest to BehatConfigTest. The YAML-vs-PHP comparison is gone, and testDistSetsEveryOption() reads the context options from behat.dist.php. The new testNoYamlConfig() covers the 6 YAML names Behat 3 checks at the root. It leaves config/ alone, because Behat 3 only looks there after behat.php.
  • File response test: ApiServerContextTest::testApiWillRespondWithFile() uses the new tests/behat/fixtures/test_data.bin for the unknown-extension case, so the test no longer needs the repo root in its paths.
  • Docs: README.md opens Usage with a single behat.php example that registers both contexts, in place of the 2 YAML examples and the separate PHP configuration section. The version table stays as it is, since Behat 3 still reads the YAML names it lists. CONTRIBUTING.md and AGENTS.md no longer describe a separate config file per Behat major, and UPGRADE.md notes that the reference configuration ships as behat.dist.php only.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 4f9670a4-dcef-4a65-a725-6e733afae36a

📥 Commits

Reviewing files that changed from the base of the PR and between fb35476 and 62f0f2b.

⛔ Files ignored due to path filters (1)
  • tests/behat/fixtures/test_data.bin is excluded by !**/*.bin
📒 Files selected for processing (9)
  • .gitattributes
  • AGENTS.md
  • CONTRIBUTING.md
  • README.md
  • UPGRADE.md
  • behat.dist.yml
  • behat.yml
  • tests/phpunit/Unit/ApiServerContextTest.php
  • tests/phpunit/Unit/BehatConfigTest.php
💤 Files with no reviewable changes (3)
  • behat.dist.yml
  • .gitattributes
  • behat.yml

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The change removes Behat YAML configuration, documents PHP configuration as the sole reference, updates archive handling, and adjusts configuration and file-response tests for the new setup.

Changes

PHP Behat configuration migration

Layer / File(s) Summary
Remove YAML configuration and update references
.gitattributes, AGENTS.md, CONTRIBUTING.md, README.md, UPGRADE.md, behat.dist.yml, behat.yml
The YAML configuration files are deleted. Documentation now references behat.php and behat.dist.php.
Align configuration and fixture tests
tests/phpunit/Unit/BehatConfigTest.php, tests/phpunit/Unit/ApiServerContextTest.php
Configuration tests validate PHP-only setup and absent YAML files. File-response tests no longer use the removed YAML file or repository-root fixture path.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 62f0f

The documented Behat 3 compatibility guidance remains valid, and no actionable current-head risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the primary change: removing both YAML configuration files so Behat 3 and Behat 4 use behat.php.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (4 skipped: 4 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/remove-behat-yml

Warning

Some tools did not complete. Review the errors below.

🔧 PHPStan (2.2.12)

Composer install failed: the lock file is not up to date with the latest changes in composer.json. Run composer update and commit the updated composer.lock.


Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Code Coverage Report:
  2026-09-16 23:02:48

 Summary:
  Classes: 40.00% (2/5)
  Methods: 77.27% (34/44)
  Lines:   93.97% (405/431)

DrevOps\BehatPhpServer\ApiServerContext
  Methods:  75.00% ( 9/12)   Lines:  95.93% (118/123)
DrevOps\BehatPhpServer\ApiServer\ApiServer
  Methods:  70.00% ( 7/10)   Lines:  88.30% ( 83/ 94)
DrevOps\BehatPhpServer\ApiServer\Request
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\BehatPhpServer\ApiServer\Response
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 39/ 39)
DrevOps\BehatPhpServer\PhpServerContext
  Methods:  76.47% (13/17)   Lines:  95.35% (164/172)

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.25%. Comparing base (fb35476) to head (62f0f2b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #142   +/-   ##
=======================================
  Coverage   96.25%   96.25%           
=======================================
  Files           3        3           
  Lines         427      427           
=======================================
  Hits          411      411           
  Misses         16       16           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Sep 16, 2026
@AlexSkrypnyk
AlexSkrypnyk merged commit 87db0ba into main Sep 17, 2026
28 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/remove-behat-yml branch September 17, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant