Skip to content

Commit 3f56ce1

Browse files
authored
Add a note about using data providers to the CONTRIBUTING.md guide
PHPCS convention is to define data providers below the test method and to name them using the "data" prefix. This commit is an attempt to document this convention in the CONTRIBUTING.md guide.
1 parent 611f7b1 commit 3f56ce1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ 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. 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()`.
387388

388389
### Submitting Your Pull Request
389390

0 commit comments

Comments
 (0)