Skip to content

Add support for Symfony 8 and Behat 4 - #233

Merged
NoResponseMate merged 12 commits into
FriendsOfBehat:masterfrom
GSadee:symfony-8-behat-4
Jul 16, 2026
Merged

Add support for Symfony 8 and Behat 4#233
NoResponseMate merged 12 commits into
FriendsOfBehat:masterfrom
GSadee:symfony-8-behat-4

Conversation

@GSadee

@GSadee GSadee commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Based on #229 and partially based on #232.

Supersedes the other Symfony 8 / Behat 4 attempts: #218, #219 and #221 (composer constraint bumps), and #222 (Symfony 8 adaptation).

Thanks to @pamil, @atomiix, @Kocal, @shahinataei-ts, @Amoifr and @bytes-max for the earlier work this builds on.

pamil and others added 7 commits June 12, 2026 12:49
behat 3.x does not support Symfony 8+. A conditional workflow step
patches the behat/behat constraint to 4.x-dev@dev for Symfony 8+ jobs
only, keeping the main composer.json on the stable ^3.22 constraint.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…SF 8.1

- Use inline alias "4.x-dev@dev as 3.31.0" so behat 4.x satisfies the
  ^3.x constraints of friends-of-behat/* packages without removing them
- Exclude PHP 8.3 + Symfony 8.1 from the matrix since SF 8.1 requires PHP >=8.4.1

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Drop the @dev stability flag from the inline alias (it caused Composer
to treat it as an exact version match rather than an alias), and
explicitly set minimum-stability=dev + prefer-stable=true so the
4.x-dev branch is resolvable.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ility

Behat 4.x dropped YAML config and docblock annotations entirely:

- Add behat.dist.php (PHP config format behat 4.x requires)
- Add tests/Behat/Config/ArrayConfig.php to wrap merged YAML arrays
  as ConfigInterface for subprocess behat.dist.php generation
- Update TestContext to write both YAML (behat 3.x) and PHP (behat 4.x)
  configs in thereIsConfiguration, updated incrementally on each call
- Add PHP 8 step/hook attributes alongside existing docblock annotations
  in thereIsFile so embedded context classes work under behat 4.x
- Resolve behat 3.x short extension names to full class names in the
  PHP config (behat 4.x requires FQCNs)
- Exclude mink_integration and fob_page_object_integration from Symfony
  8+ CI runs (those extensions do not yet support behat 4.x)
- Also exclude PHP 8.3 + Symfony 8.0 (Symfony 8.0 requires PHP >=8.4)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… only

- Bump behat to ^3.31 (first version with both PHP 8 attr and PHP config support)
- Replace all short extension names in feature files with FQCNs so no
  name resolution is needed in TestContext
- TestContext: single code path for behat 3.31 and 4.x — no isBehat4
  detection, no behat3Imports, no resolveExtensionClass map
- thereIsConfiguration: writes only behat.dist.php (PHP config); both
  behat 3.31 and 4.x can read it, with behat.yml.dist taking priority
  for the outer run in behat 3.31
- thereIsFile: always replaces @Given/@When/@then docblocks with PHP 8
  attributes so subprocess context classes work identically under both
- Also exclude PHP 8.3 + Symfony 8.0 from CI matrix (SF 8.0 requires PHP >=8.4)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
friends-of-behat/service-container-extension uses XmlFileLoader which
was removed in Symfony 8. Exclude the three affected sanity_checks
feature files instead of the whole directory.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Thomas Baccelli <thomasbaccelli@tabesto.com>
@GSadee
GSadee marked this pull request as draft July 13, 2026 12:14
@GSadee
GSadee force-pushed the symfony-8-behat-4 branch from 87c444a to 2e87be3 Compare July 15, 2026 13:00
@GSadee
GSadee marked this pull request as ready for review July 15, 2026 13:06
GSadee and others added 5 commits July 16, 2026 13:41
Co-authored-by: shahinataei-ts <shahin.ataei@ticketswap.com>
Co-authored-by: Maximilian Graf Schimmelmann <max@schimmelmann.org>
Co-authored-by: Hugo Alliaume <hugo@alliau.me>
Co-authored-by: shahinataei-ts <shahin.ataei@ticketswap.com>
Co-authored-by: Pascal CESCON - Amoifr <pascal.cescon@gmail.com>
@GSadee
GSadee force-pushed the symfony-8-behat-4 branch from e2dfd49 to 0dbda8c Compare July 16, 2026 11:42
@NoResponseMate
NoResponseMate merged commit a587fe1 into FriendsOfBehat:master Jul 16, 2026
10 checks passed
@GSadee
GSadee deleted the symfony-8-behat-4 branch July 17, 2026 04:00
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.

3 participants