Skip to content

feat: Add support for PHPUnit 11 - 13 - #6

Merged
acoulton merged 5 commits into
1.xfrom
phpunit-11-13
Sep 20, 2026
Merged

acoulton merged 5 commits into
1.xfrom
phpunit-11-13

Conversation

@acoulton

Copy link
Copy Markdown
Contributor

These are the versions that introduced the requirement to bootstrap PHPUnit's configuration before stringifying most assertion failures - and which finally prompted us to advise against using PHPUnit for Behat assertions.

We published a workaround for this in the docs
https://docs.behat.org/en/latest/useful_resources.html#assertion-tools

  • but now that we enforce the supported PHPUnit versions, and know that the end-user wants to use PHPUnit assertions, I think it's reasonable to do the bootstrapping within our extension.

I've done that within the first BeforeSuite event, so that if it triggers an error in future that should be detected in a test report rather than e.g. being a fatal Behat crash.

@acoulton
acoulton added this pull request to stack #3 September 17, 2026 15:18
@acoulton acoulton mentioned this pull request Sep 17, 2026
8 tasks done
@acoulton
acoulton marked this pull request as ready for review September 17, 2026 15:21
@acoulton

Copy link
Copy Markdown
Contributor Author

For clarity, we'd still advise people NOT to use PHPUnit for assertions in new projects. We'd also make clear that there are no guarantees we will (or will be able to) support future PHPUnit releases.

However, since we can get the current known majors working I think we should at least support those, rather than blocking existing projects on older PHPUnit versions until they migrate their Behat assertions to another tool.

@acoulton
acoulton force-pushed the phpunit-11-13 branch 2 times, most recently from 21f6a2d to 221d14b Compare September 18, 2026 17:00

@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.

Looking good @acoulton just some tiny changes needed

@@ -0,0 +1,32 @@
@phpunit-11
Feature: PHPUnit assertions are rendered as expected with PHPUnit 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be "11"

@@ -0,0 +1,32 @@
@phpunit-12
Feature: PHPUnit assertions are rendered as expected with PHPUnit 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be "12"

@@ -0,0 +1,32 @@
@phpunit-13
Feature: PHPUnit assertions are rendered as expected with PHPUnit 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be "13"

Base automatically changed from initial-implementation to 1.x September 20, 2026 08:08
These are the versions that introduced the requirement to bootstrap
PHPUnit's configuration before stringifying most assertion failures -
and which finally prompted us to advise against using PHPUnit for Behat
assertions.

We published a workaround for this in the docs
https://docs.behat.org/en/latest/useful_resources.html#assertion-tools
- but now that we enforce the supported PHPUnit versions, and know that
the end-user wants to use PHPUnit assertions, I think it's reasonable to
do the bootstrapping within our extension.

I've done that within the first BeforeSuite event, so that if it
triggers an error in future that should be detected in a test report
rather than e.g. being a fatal Behat crash.
@acoulton

Copy link
Copy Markdown
Contributor Author

Thanks @carlos-granados, good catch - sorry I didn't spot them. Fixed now

@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.

All good now @acoulton

@acoulton
acoulton merged commit da840c2 into 1.x Sep 20, 2026
13 checks passed
@acoulton
acoulton deleted the phpunit-11-13 branch September 20, 2026 08:37
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