Skip to content

fix: Extension is broken with released Behat 4.0 - #12

Open
acoulton wants to merge 4 commits into
1.xfrom
1.x-fix-classes
Open

acoulton wants to merge 4 commits into
1.xfrom
1.x-fix-classes

Conversation

@acoulton

@acoulton acoulton commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Although the extension worked against Behat 3.x and 4.x when it was built, it now causes errors when run with 4.x.

Embarrassingly, I didn't notice my IDE had imported a use statement for Behat's own PHPUnitExceptionStringer class. At the time, that class was still present in the 4.x series, but now that the PR removing it has been merged the extension obviously fails to load.

Our own version of PHPUnitExceptionStringer was never used, meaning we also didn't catch that the API signature is incompatible with Behat 3.x due to the presence of strict parameter types. That's also now fixed.

Finally (and as originally planned), removes the temporary hack for testing without the built-in functionality enabled (since this fails now that Behat 4.0 does not have any built-in functionality).

Fixes #11

Although the extension worked against Behat 3.x and 4.x when it was
built, it now causes errors when run with 4.x.

Embarrassingly, I didn't notice my IDE had imported a `use` statement
for Behat's own PHPUnitExceptionStringer class. At the time, that class
was still present in the 4.x series, but now that the PR removing it has
been merged the extension obviously fails to load.

Our own version of PHPUnitExceptionStringer was never used, meaning we
also didn't catch that the API signature is incompatible with Behat 3.x
due to the presence of strict parameter types. That's also now fixed.
Now that Behat 4 has no built-in support for stringifying PHPUnit, we
don't need the hack to disable the built-in support when testing.

However, the output in Behat 3.x without this extension is different,
and coupled to the implementation of Behat 3.x built-in stringer. Since
that is already covered by Behat's own features, I think it is both
unnecessary and brittle to test it here (and confusing, since the output
with and without this extension would currently be very similar).

Therefore, I have instead refactored the suite and Behat profiles so
that we only test the behaviour without this extension installed when
running Behat 4.x.
Unlikely to include anything else in 1.1.0 - prepare the CHANGELOG now
so it's ready.
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.

Incorrect PHPUnitExceptionStringer namespace prevents Behat 4 from starting

1 participant