Skip to content

feat: behat 4.x compatibility#232

Open
atomiix wants to merge 1 commit into
FriendsOfBehat:masterfrom
atomiix:behat-4-support
Open

feat: behat 4.x compatibility#232
atomiix wants to merge 1 commit into
FriendsOfBehat:masterfrom
atomiix:behat-4-support

Conversation

@atomiix

@atomiix atomiix commented Jun 25, 2026

Copy link
Copy Markdown

Adds support for Behat 4.x, which drops two things this extension and its test suite relied on: YAML configuration and doc-block annotations (both replaced: config by PHP files, step/hook definitions by PHP 8 attributes).

Production change

  • InitializedSymfonyExtensionEnvironment::bindCallee() now handles Behat 4's new LateBoundContextMethodCallable, binding it to the resolved context instance via bindTo(). This is the one code change needed for the extension itself to work under Behat 4 (per the changelog's "use explicit type for late-bound Context callable methods").

Test suite migration (Behat 4 dropped YAML config + annotations)

  • Replaced behat.yml.dist with behat.dist.php using the new Config/Profile/Suite builder objects.
  • Migrated TestContext from @Given/@When/@Then/@BeforeScenario annotations to #[Given]/#[When]/#[Then]/#[BeforeScenario] attributes.
  • TestContext::thereIsConfiguration() now generates PHP config files (behat.php), eval-ing the inline PHP snippet into a Config object and persisting it via serialize()/unserialize() rather than parsing/dumping YAML.
  • Updated all feature files to use PHP-based Behat configuration and attribute-based step definitions in their inline fixtures.

This PR depends on FriendsOfBehat/MinkExtension#58

@atomiix atomiix marked this pull request as ready for review June 25, 2026 17:20
Comment thread composer.json
Comment on lines 27 to 30
"symfony/browser-kit": "^7.4",
"symfony/framework-bundle": "^7.4",
"symfony/process": "^7.4",
"symfony/yaml": "^7.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not compatible with behat 4 and symfony 8, not sure if this is wanted but definitely a heads up.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l-stauberg it’s kinda on purpose, there is already 5 PRs adding Symfony 8/Behat 4, I thought maybe we can merge them before and only add this one on top for full compatibility.

But I can definitely make the change as well if needed!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just wait for #229

That should be fine then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants