Skip to content

feat: Add support for Behat 3.x - #9

Merged
acoulton merged 1 commit into
1.xfrom
feat-support-behat-3x
Sep 21, 2026
Merged

acoulton merged 1 commit into
1.xfrom
feat-support-behat-3x

Conversation

@acoulton

Copy link
Copy Markdown
Contributor

This extension supports PHPUnit 11-13, which are broken even with the built-in PHPUnit support on Behat 3.x.

Therefore, we should make this extension available for Behat 3.x as well. As it stands, that will enable the PHPUnit bootstrapping required to get 11-13 working. However it will still use Behat 3's built-in stringer, as that is registered first.

Once we release the extension, we can update Behat 3.x so that:

  • The built-in ExceptionExtension doesn't register the built-in PHPUnitExceptionStringer if this extension is installed and enabled.
  • The built-in PHPUnitExceptionStringer emits a Behat deprecation recommending this extension if it receives an assertion failure.
  • We can simplify the Behat docs to remove details of the old workaround and instead point people to this extension for all Behat versions.

End-users who install the extension with Behat 3.x will immediately benefit from better PHPUnit support, and will have a smoother upgrade path to 4.0.

It also means we don't have to consider / make changes to the old core stringer in 3.x even if it stops working with future PHPUnit releases - we can just point people to this extension where it should be easier to deliver a fix.

Note, we can't just forcibly add this as a Behat 3.x composer dependency (which would sometimes be an option for splitting features out of a package), because it introduces a hard dependency on PHPUnit and therefore can only be an end-user opt-in.

This extension supports PHPUnit 11-13, which are broken even with the built-in PHPUnit
support on Behat 3.x.

Therefore, we should make this extension available for Behat 3.x as well. As it stands,
that will enable the PHPUnit bootstrapping required to get 11-13 working. However
it will still use Behat 3's built-in stringer, as that is registered first.

Once we release the extension, we can update Behat 3.x so that:

* The built-in ExceptionExtension doesn't register the built-in PHPUnitExceptionStringer
  if this extension is installed and enabled.
* The built-in PHPUnitExceptionStringer emits a Behat deprecation recommending this extension
  if it receives an assertion failure.
* We can simplify the Behat docs to remove details of the old workaround and instead point
   people to this extension for all Behat versions.

End-users who install the extension with Behat 3.x will immediately benefit from better PHPUnit support, and will have a smoother upgrade path to 4.0.

It also means we don't have to consider / make changes to the old core stringer in 3.x
even if it stops working with future PHPUnit releases - we can just point people to this extension where it should be easier to deliver a fix.
@acoulton
acoulton marked this pull request as ready for review September 20, 2026 16:32

@carlos-granados carlos-granados left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sounds good, @acoulton

@acoulton
acoulton merged commit d3224c8 into 1.x Sep 21, 2026
14 checks passed
@acoulton
acoulton deleted the feat-support-behat-3x branch September 21, 2026 17:22
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