From a0f58ae2f4b8493be69c8e31e65315896b3113a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 14 Dec 2025 02:40:33 +0100 Subject: [PATCH] test: Fix PHPUnit 11 use in Behat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/integration/features/bootstrap/FeatureContext.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index bd84f5caeb..306e18a09b 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -15,6 +15,7 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Gherkin\Node\TableNode; use Behat\Hook\AfterScenario; use Behat\Hook\BeforeScenario; +use Behat\Hook\BeforeSuite; use Behat\Step\Given; use Behat\Step\Then; use Behat\Step\When; @@ -208,6 +209,11 @@ class FeatureContext implements Context, SnippetAcceptingContext { } } + #[BeforeSuite] + public static function createPHPUnitConfiguration(): void { + (new \PHPUnit\TextUI\Configuration\Builder())->build([]); + } + #[BeforeScenario] public function setUp(BeforeScenarioScope $scope): void { self::$currentScenario = $scope->getFeature()->getTitle() . ':' . $scope->getScenario()->getLine() . ' - ' . $scope->getScenario()->getTitle();