Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jul 12, 2025

closes #6260

After this PR the default phpunit result printer will format errors the same way the --filter CLI option expects them.

that way the user can copy/paste the tool output and re-use it as the CLI filter option value:


phpunit output for numbered datasets:

There was 1 failure:

1) testSuiteSorterDefectsWithDataProviderTest::testOne#1 with data (false)
Failed asserting that false is true.

CLI option for numbered datasets:
--filter "testSuiteSorterDefectsWithDataProviderTest::testOne#1"


phpunit output for named datasets:

There was 1 failure:

1) testSuiteSorterDefectsWithDataProviderTest::testOne@data-set with data (false)
Failed asserting that false is true.

CLI option for named datasets:
--filter "testSuiteSorterDefectsWithDataProviderTest::testOne@data-set"

/**
* @internal This method is not covered by the backward compatibility promise for PHPUnit
*/
final public function dataSetAsString(): string
Copy link
Contributor Author

@staabm staabm Jul 12, 2025

Choose a reason for hiding this comment

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

since TestDox formatter does not use the className::methodName <dataset> format, I did not change the format in this method itself but created a new dataSetAsFilterString for use only in the default-printer

@staabm staabm marked this pull request as ready for review July 12, 2025 10:04
@staabm
Copy link
Contributor Author

staabm commented Jul 12, 2025

commit 1&2 are pure refactoring. the actual change is in commit 3

@sebastianbergmann sebastianbergmann added this to the PHPUnit 12.3 milestone Jul 12, 2025
@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/test-runner CLI test runner feature/data-provider Data Providers feature/configuration/cli labels Jul 12, 2025
@sebastianbergmann sebastianbergmann merged commit ff57330 into sebastianbergmann:main Jul 12, 2025
25 checks passed
@staabm staabm deleted the data-filter branch July 12, 2025 11:07
@sebastianbergmann sebastianbergmann changed the title Use "@<data-set-name>" --filter CLI option compatible error format Use @<data-set-name> format (compatible with --filter CLI option) in defect messages Jul 12, 2025
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/form that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/yaml that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/security-bundle that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/console that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/validator that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
symfony-splitter pushed a commit to symfony/var-dumper that referenced this pull request Aug 12, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

 run tests with PHPUnit 12.3

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

The test updates reflect the following changes in PHPUnit 12.2 and 12.3:

- a warning is emitted when a data provider provides data sets that have more values than the test method consuming the data set
- the format in which data sets are displayed in test reports has changed affecting the modified test in the PhpUnitBridge (see sebastianbergmann/phpunit#6272)
- errors triggered in the `tearDown()` method of skipped tests are no longer silence affecting the modified tests in the Form component where the `$defaultLocale` property is not initialised (see sebastianbergmann/phpunit#6281)

Commits
-------

cf7e41e1092 run tests with PHPUnit 12.3
schlndh added a commit to schlndh/phpunit that referenced this pull request Sep 12, 2025
As far as I can tell the goal was to change the test name printed by the
default printer to make it easier to copy-paste it into --filter.

Example:

1) PHPUnit\TestFixture\DataProviderFilterTest::testFalse@other false test2 with data (false)

Into:

--filter 'testFalse@other false test2'

However, the PR changed the test name more broadly than necessary. This
broke --filter pattern used by PHPStorm. E.g:

--filter '/PHPUnit\\TestFixture\\DataProviderFilterTest::testFalse with data set \"other false test\"$/'
schlndh added a commit to schlndh/phpunit that referenced this pull request Sep 12, 2025
It was broken by PR sebastianbergmann#6272.  As far as I can tell the goal was to change
the test name printed by the default printer to make it easier to
copy-paste it into --filter.

Example:

1) PHPUnit\TestFixture\DataProviderFilterTest::testFalse@other false test2 with data (false)

Into:

--filter 'testFalse@other false test2'

However, the PR changed the test name more broadly than necessary. This
broke --filter pattern used by PHPStorm. E.g:

--filter '/PHPUnit\\TestFixture\\DataProviderFilterTest::testFalse with data set \"other false test\"$/'
schlndh added a commit to schlndh/phpunit that referenced this pull request Oct 8, 2025
It was broken by PR sebastianbergmann#6272.  As far as I can tell the goal was to change
the test name printed by the default printer to make it easier to
copy-paste it into --filter.

Example:

1) PHPUnit\TestFixture\DataProviderFilterTest::testFalse@other false test2 with data (false)

Into:

--filter 'testFalse@other false test2'

However, the PR changed the test name more broadly than necessary. This
broke --filter pattern used by PHPStorm. E.g:

--filter '/PHPUnit\\TestFixture\\DataProviderFilterTest::testFalse with data set \"other false test\"$/'
sebastianbergmann pushed a commit that referenced this pull request Oct 9, 2025
It was broken by PR #6272.  As far as I can tell the goal was to change
the test name printed by the default printer to make it easier to
copy-paste it into --filter.

Example:

1) PHPUnit\TestFixture\DataProviderFilterTest::testFalse@other false test2 with data (false)

Into:

--filter 'testFalse@other false test2'

However, the PR changed the test name more broadly than necessary. This
broke --filter pattern used by PHPStorm. E.g:

--filter '/PHPUnit\\TestFixture\\DataProviderFilterTest::testFalse with data set \"other false test\"$/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/configuration/cli feature/data-provider Data Providers feature/test-runner CLI test runner type/enhancement A new idea that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DX: filtering tests by "data provider name" vs. index

2 participants