Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Dec 8, 2025

Follow up to #55870

Starting with PHPUnit 11.3, some complex outputs of certain asserts (like assertStringContainsString) require the output of PHPUnit to be explicitly setup. Otherwise when the assert fails a type error is thrown (although it does not seem to affect asserts with simpler outputs, like assertEquals).

Note that PHPUnit asserts have never been intended to be used as standalone methods, even if it worked and it was recommended by Behat. In the future it might be needed to move to a different library, but for now this adjustment seems to be enough.

How to test

  • Modify any integration test with the "the command output contains the text XXX" so the check fails
  • Run the integration test

Result with this pull request

The output shows the actual and expected texts

Result without this pull request

A type error is thrown: Type error: PHPUnit\TextUI\Configuration\Registry::get(): Return value must be of type PHPUnit\TextUI\Configuration\Configuration, null returned (Behat\Testwork\Call\Exception\FatalThrowableError)

@danxuliu danxuliu added this to the Nextcloud 33 milestone Dec 8, 2025
@danxuliu danxuliu requested a review from a team as a code owner December 8, 2025 15:39
@danxuliu danxuliu added the bug label Dec 8, 2025
@danxuliu danxuliu requested review from leftybournes, salmart-dev and yemkareems and removed request for a team December 8, 2025 15:39
@danxuliu danxuliu added the 3. to review Waiting for reviews label Dec 8, 2025
@danxuliu danxuliu requested a review from CarlSchwan December 8, 2025 15:39
@danxuliu danxuliu added the tests Related to tests label Dec 8, 2025
Starting with PHPUnit 11.3, some complex outputs of certain asserts
(like "assertStringContainsString") require the output of PHPUnit to be
explicitly setup. Otherwise when the assert fails a type error is
thrown (although it does not seem to affect asserts with simpler
outputs, like "assertEquals").

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu force-pushed the fix-phpunit-11-use-in-behat branch from ba22d25 to 19c9d88 Compare December 13, 2025 19:55
@danxuliu danxuliu merged commit a1c2a25 into master Dec 15, 2025
220 of 227 checks passed
@danxuliu danxuliu deleted the fix-phpunit-11-use-in-behat branch December 15, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants