Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect TestDox output for data provider with indexed array #3321

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Util/TestDox/NamePrettifier.php
Expand Up @@ -85,7 +85,7 @@ public function prettifyTestCase(TestCase $test): string
}

if ($test->usesDataProvider() && !$annotationWithPlaceholders) {
$result .= ' data set "' . $test->dataDescription() . '"';
$result .= $test->getDataSetAsString(false);
}

return $result;
Expand Down
20 changes: 18 additions & 2 deletions tests/_files/DataProviderTestDoxTest.php
Expand Up @@ -13,7 +13,7 @@ class DataProviderTestDoxTest extends TestCase
{
/**
* @dataProvider provider
* @testdox Does something with
* @testdox Does something
*/
public function testOne(): void
{
Expand All @@ -23,7 +23,15 @@ public function testOne(): void
/**
* @dataProvider provider
*/
public function testDoesSomethingElseWith(): void
public function testDoesSomethingElse(): void
{
$this->assertTrue(true);
}

/**
* @dataProvider providerWithIndexedArray
*/
public function testWithProviderWithIndexedArray($value): void
{
$this->assertTrue(true);
}
Expand All @@ -45,6 +53,14 @@ public function provider()
];
}

public function providerWithIndexedArray()
{
return [
['first'],
['second'],
];
}

public function placeHolderprovider(): array
{
return [
Expand Down
4 changes: 3 additions & 1 deletion tests/end-to-end/dataprovider-testdox.phpt
Expand Up @@ -17,6 +17,8 @@ DataProviderTestDox
✔ Does something with data set "two"
✔ Does something else with data set "one"
✔ Does something else with data set "two"
✔ With provider with indexed array with data set #0
✔ With provider with indexed array with data set #1
✔ ... true ...
✔ ... 1 ...
✔ ... 1.0 ...
Expand All @@ -29,4 +31,4 @@ DataProviderTestDox

Time: %s, Memory: %s

OK (13 tests, 13 assertions)
OK (15 tests, 15 assertions)