From fb5fc179aa9720413b9b3ce39839c1f4d52e2aa5 Mon Sep 17 00:00:00 2001 From: Benjamin Fahl Date: Mon, 23 Feb 2026 21:08:17 +0100 Subject: [PATCH 1/2] test: add regression test for upstream codeception sprintf bug --- tests/Unit/ReportPrinterSprintfBugTest.php | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/Unit/ReportPrinterSprintfBugTest.php diff --git a/tests/Unit/ReportPrinterSprintfBugTest.php b/tests/Unit/ReportPrinterSprintfBugTest.php new file mode 100644 index 0000000..1306a58 --- /dev/null +++ b/tests/Unit/ReportPrinterSprintfBugTest.php @@ -0,0 +1,34 @@ +> + */ + public static function provideEscapedPercentInNameCases(): iterable + { + return [ + // The %% is rendered as % by the Codeception ReportPrinter sprintf + '100%% safely escaped' => [1], + ]; + } +} From 91e7776461a0990cec6eb04b8b364766bc145c65 Mon Sep 17 00:00:00 2001 From: Benjamin Fahl Date: Mon, 23 Feb 2026 22:21:10 +0100 Subject: [PATCH 2/2] test: remove workaround to expose upstream bug --- tests/Unit/ReportPrinterSprintfBugTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/Unit/ReportPrinterSprintfBugTest.php b/tests/Unit/ReportPrinterSprintfBugTest.php index 1306a58..2c19f7b 100644 --- a/tests/Unit/ReportPrinterSprintfBugTest.php +++ b/tests/Unit/ReportPrinterSprintfBugTest.php @@ -7,9 +7,10 @@ use PHPUnit\Framework\TestCase; /** - * Validates that escaping a percent sign as `%%` works around the Codeception 5 - * upstream ArgumentCountError in `Codeception\Reporter\ReportPrinter` using the - * `--report` cli flag. + * Exposes the upstream Codeception 5 ArgumentCountError in `Codeception\Reporter\ReportPrinter` + * using the `--report` cli flag when a test name contains a `%`. + * + * @see https://github.com/Codeception/Codeception/pull/6927 */ class ReportPrinterSprintfBugTest extends TestCase { @@ -27,8 +28,8 @@ public function testEscapedPercentInName(int $value): void public static function provideEscapedPercentInNameCases(): iterable { return [ - // The %% is rendered as % by the Codeception ReportPrinter sprintf - '100%% safely escaped' => [1], + // This test is expected to fail with `ArgumentCountError` due to a bug in Codeception ReportPrinter + '100% coverage' => [1], ]; } }