Skip to content

Commit 0c8ebb7

Browse files
authored
Merge 0797ad5 into a62c2f8
2 parents a62c2f8 + 0797ad5 commit 0c8ebb7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@ To run the tests specific to the use of `PHP_CODESNIFFER_CBF === true`:
376376
vendor/bin/phpunit --group CBF --exclude-group nothing
377377
```
378378

379+
#### Other notes about writing tests
380+
381+
* The `Config` class uses a number of static properties and can have a performance impact on the tests too.
382+
To get round both these issues, use the `ConfigDouble` class instead.
383+
Generally speaking, only tests which test the behaviour of the `Config` class itself where it relates to the static properties, should use the real `Config` class for testing.
384+
In such cases, the `PHP_CodeSniffer\Tests\Core\Config\AbstractRealConfigTestCase` should be used as the base test class.
385+
* Tests for the `Runner` class often can't create their own `Config` object in the tests, so run into the same issue.
386+
Those tests should use the `PHP_CodeSniffer\Tests\Core\Runner\AbstractRunnerTestCase` base class, which will ensure the Config is clean.
379387

380388
### Submitting Your Pull Request
381389

0 commit comments

Comments
 (0)