Skip to content

Commit fd23ec5

Browse files
authored
add compatibility for data providers without named sets (via allure-framework#77)
1 parent f3d0cff commit fd23ec5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/Internal/TestLifecycle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function getCurrentTest(): TestInfo
166166
private function buildTestInfo(string $test, ?string $host = null, ?string $thread = null): TestInfo
167167
{
168168
$dataLabelMatchResult = preg_match(
169-
'#^([^\s]+)\s+with\s+data\s+set\s+"(.*)"\s+\(.+\)$#',
169+
'#^([^\s]+)\s+with\s+data\s+set\s+(\#\d+|".+")\s+\(.+\)$#',
170170
$test,
171171
$matches,
172172
);

test/report/Generate/RetriesTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ public function providerData(): iterable
5757
];
5858
}
5959

60+
/**
61+
* @dataProvider providerIndexedData
62+
*/
63+
#[
64+
DisplayName('Reruns of test with indexed data provider are reported correctly'),
65+
Description("Parameter `retry` has different value on each run but is excluded and doesn't have effect"),
66+
]
67+
public function testRerunsOfTestWithIndexedDataProvider(string $firstValue, string $secondValue): void
68+
{
69+
Allure::parameter('First argument', $firstValue);
70+
Allure::parameter('Second argument', $secondValue);
71+
Allure::parameter('Run index', (string) $this->getRunIndex(__METHOD__), true);
72+
$this->expectNotToPerformAssertions();
73+
}
74+
75+
/**
76+
* @return iterable<array{string, string}>
77+
*/
78+
public function providerIndexedData(): iterable
79+
{
80+
return [
81+
['a', 'b'],
82+
['b', 'b'],
83+
];
84+
}
85+
6086
private function getRunIndex(string $method): int
6187
{
6288
self::$runCounters[$method] ??= 0;

0 commit comments

Comments
 (0)