fix: PhpUnitAttributesFixer - handle parentheses after data provider method name#8510
Conversation
| #[\PHPUnit\Framework\Attributes\DataProvider('provideFooCases()')] | ||
| #[\PHPUnit\Framework\Attributes\DataProviderExternal(AnotherTest::class, 'provideBarCases()')] |
There was a problem hiding this comment.
Shouldn't it be like this?
| #[\PHPUnit\Framework\Attributes\DataProvider('provideFooCases()')] | |
| #[\PHPUnit\Framework\Attributes\DataProviderExternal(AnotherTest::class, 'provideBarCases()')] | |
| #[\PHPUnit\Framework\Attributes\DataProvider('provideFooCases')] | |
| #[\PHPUnit\Framework\Attributes\DataProviderExternal(AnotherTest::class, 'provideBarCases')] |
(in order to fail pipeline and show that it does not work as expected right now).
There was a problem hiding this comment.
When the bug results in valid syntax I prefer to show the incorrect change rather than the failed pipeline. For 2 reasons:
- Paraunit is not showing diffs (so I have to modify
ci.yamlto run PHPUnit with the single file for such commit) - CI results will expire one day, when the commits in PR will stay with us.
There was a problem hiding this comment.
Then maybe there should be 3 commits:
- test case with existing, invalid behaviour (CI green)
- changes in expectation (CI red)
- actual fix (CI green)
First 2 commits could be pushed together IMHO, as most interesting is to show it does not work as expected (first commit would be mostly for historical reasons). Then the 3rd commit provides a solution. This way it would either show wrong behaviour (1st commit) and correct behaviour (2nd and 3rd commit).
But it's up to you.
Fixes #8509