Skip to content

test: expose upstream codeception sprintf bug#4

Open
Fahl-Design wants to merge 2 commits intomainfrom
bugfix/report-printer-sprintf-bug
Open

test: expose upstream codeception sprintf bug#4
Fahl-Design wants to merge 2 commits intomainfrom
bugfix/report-printer-sprintf-bug

Conversation

@Fahl-Design
Copy link
Member

@Fahl-Design Fahl-Design commented Feb 23, 2026

This adds a unit test demonstrating the ArgumentCountError bug in Codeception ReportPrinter when formatting output with a % symbol. The test is currently intentionally failing and references Codeception/Codeception#6927 until the bug is resolved.

Summary by CodeRabbit

  • Tests
    • Added unit test coverage for a known Codeception compatibility issue occurring when test names contain percent signs with the report flag enabled.

@Fahl-Design Fahl-Design changed the title test: add regression test for upstream codeception sprintf bug test: expose upstream codeception sprintf bug Feb 23, 2026
@Fahl-Design Fahl-Design force-pushed the bugfix/report-printer-sprintf-bug branch from 6a0faa9 to 91e7776 Compare March 17, 2026 20:07
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

A new unit test file is added to expose a known upstream Codeception 5 bug in ReportPrinter that occurs when test names contain percent signs with the --report flag. The test uses a data-driven approach with a single test case labeled "100% coverage".

Changes

Cohort / File(s) Summary
Test Coverage for Known Bug
tests/Unit/ReportPrinterSprintfBugTest.php
New unit test class exposing upstream Codeception ArgumentCountError bug. Includes data-driven test testEscapedPercentInName() with data provider provideEscapedPercentInNameCases() supplying test case "100% coverage".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A test hopped in with percent signs so bright,
To catch a bug hiding in ReportPrinter's sight,
With data-driven tales and "100% coverage" cheer,
We document the quirks that Codeception brings near! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: expose upstream codeception sprintf bug' clearly and specifically describes the main change—adding a test that exposes a known bug in Codeception's sprintf/report functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/report-printer-sprintf-bug
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use your project's `phpmd` ruleset to improve the quality of PHP code reviews.

You can customize the ruleset in your CodeRabbit configuration, or provide a path to a custom ruleset file.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/Unit/ReportPrinterSprintfBugTest.php (1)

25-34: Consider aligning return type with PHPDoc for precision.

The PHPDoc documents @return array<string, array<int>> but the method signature uses iterable. While compatible, using array as the return type would be more precise and consistent with the documentation.

♻️ Optional: Use more specific return type
     /**
      * `@return` array<string, array<int>>
      */
-    public static function provideEscapedPercentInNameCases(): iterable
+    public static function provideEscapedPercentInNameCases(): array
     {
         return [
             // This test is expected to fail with `ArgumentCountError` due to a bug in Codeception ReportPrinter
             '100% coverage' => [1],
         ];
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/Unit/ReportPrinterSprintfBugTest.php` around lines 25 - 34, The method
provideEscapedPercentInNameCases currently declares an iterable return type but
the PHPDoc and actual returned value are an array; update the signature of
provideEscapedPercentInNameCases to return array to match the `@return`
array<string, array<int>> PHPDoc and the returned literal, ensuring the method
name provideEscapedPercentInNameCases and its return value stay unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/Unit/ReportPrinterSprintfBugTest.php`:
- Around line 25-34: The method provideEscapedPercentInNameCases currently
declares an iterable return type but the PHPDoc and actual returned value are an
array; update the signature of provideEscapedPercentInNameCases to return array
to match the `@return` array<string, array<int>> PHPDoc and the returned literal,
ensuring the method name provideEscapedPercentInNameCases and its return value
stay unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f3d7d7d1-f1b0-4d70-a5dd-3d505e22d2d1

📥 Commits

Reviewing files that changed from the base of the PR and between c1e8c3a and 91e7776.

📒 Files selected for processing (1)
  • tests/Unit/ReportPrinterSprintfBugTest.php

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.

1 participant