-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: expand the unit test suite #146
Comments
This was referenced Dec 13, 2023
This was referenced Dec 20, 2023
This was referenced Dec 27, 2023
This was referenced Jan 3, 2024
This was referenced Jan 11, 2024
This was referenced Jan 14, 2024
11 tasks
6 tasks
This was referenced Jan 29, 2024
6 tasks
PR #340 for the See #340 (comment) for a list of things which need to be addressed in that sniff. |
This was referenced Mar 6, 2024
Merged
11 tasks
This was referenced Apr 18, 2024
11 tasks
This was referenced May 9, 2024
11 tasks
1 task
This was referenced Jun 5, 2024
11 tasks
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As of PR #144, code coverage will now be measured and recorded for every PR and push.
The resulting reports can be found here: https://coveralls.io/github/PHPCSStandards/PHP_CodeSniffer
As can be seen there, code coverage for the sniffs is pretty good, but for most other areas of the code... not so much.
The test suite should be expanded to allow for merging with (more) confidence.
Some thoughts on this:
While there are tests covering parts of thePHP_CodeSniffer\Tokenizers\PHP
class, these tests don't currently register code coverage due to the test set up.This may be fixable with some tweaks to the existingAbstractMethodUnitTest
test case, but may also require a separate test case class to get this working.I will probably look into this myself.Fixed via Tests: fix recording code coverage for Tokenizer tests #314
Generators
as well as theReports
, a new abstract test case may need to be introduced to get those tests set up more easily.Getting started
Think about what the sniff is checking for and get creative with writing horribly formatted code to make sure the sniff detects this correctly.
Adding tests with modern PHP syntaxes is a huge help, cause even if the sniff already handles this syntax correctly, the tests will safeguard that it continues to do so, even when the code in the sniff changes.
src/Util
directory, like those in theTiming
andCommon
classes.Writing new tests for non-sniff code will be more complicated and may require some creativeness in setting those up. When in doubt on whether your approach is the right one, please discuss before execute.
When writing tests, keep in mind that the tests need to be able to run on PHP 5.4 (PHPUnit 4.x) up to PHP 8.3/4 (PHPUnit 9.x).
PRs related to this task should preferably only touch the tests for one sniff/one class/one function per PR.
The text was updated successfully, but these errors were encountered: