Skip to content

Commit fb5fc17

Browse files
committed
test: add regression test for upstream codeception sprintf bug
1 parent c1e8c3a commit fb5fc17

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WebProject\Codeception\Module\AiReporter\Tests\Unit;
6+
7+
use PHPUnit\Framework\TestCase;
8+
9+
/**
10+
* Validates that escaping a percent sign as `%%` works around the Codeception 5
11+
* upstream ArgumentCountError in `Codeception\Reporter\ReportPrinter` using the
12+
* `--report` cli flag.
13+
*/
14+
class ReportPrinterSprintfBugTest extends TestCase
15+
{
16+
/**
17+
* @dataProvider provideEscapedPercentInNameCases
18+
*/
19+
public function testEscapedPercentInName(int $value): void
20+
{
21+
self::assertSame(1, $value);
22+
}
23+
24+
/**
25+
* @return array<string, array<int>>
26+
*/
27+
public static function provideEscapedPercentInNameCases(): iterable
28+
{
29+
return [
30+
// The %% is rendered as % by the Codeception ReportPrinter sprintf
31+
'100%% safely escaped' => [1],
32+
];
33+
}
34+
}

0 commit comments

Comments
 (0)