Skip to content

Commit ec277a7

Browse files
authored
Merge pull request #1148 from rodrigoprimo/patch-1
Add a note about using data providers to the CONTRIBUTING.md guide
2 parents 611f7b1 + ad9bcc0 commit ec277a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ To run the tests specific to the use of `PHP_CODESNIFFER_CBF === true`:
384384
In such cases, the `PHP_CodeSniffer\Tests\Core\Config\AbstractRealConfigTestCase` should be used as the base test class.
385385
* Tests for the `Runner` class often can't create their own `Config` object in the tests, so run into the same issue.
386386
Those tests should use the `PHP_CodeSniffer\Tests\Core\Runner\AbstractRunnerTestCase` base class, which will ensure the Config is clean.
387+
* When using data providers, define them immediately below the corresponding test method.
388+
* When a test method has only one data provider, it is considered best practice to closely couple the test and data provider methods via their names. I.e. the data provider's name should match the test method name, replacing the "test" prefix with "data". For example, the data provider for a method named `testSomething()` should be `dataSomething()`.
387389

388390
### Submitting Your Pull Request
389391

0 commit comments

Comments
 (0)