-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Snake or camel casing for phpunit tests #3302
Comments
is there any big community using underscore convension for tests ? |
I don't know, but I used camelCase since ever (maybe 10 years) and snake_case since this week, and can be much more readable if the method names are longer than 100 chars, which is a good practice if you have a complex domain with thousand edge cases for every single feature/spec. |
you are using it globally, or just for test method names? |
Just test method names. |
why do you consider long name inside |
There is a fundamental difference between the two environments: in |
This PR was squashed before being merged into the 2.13-dev branch (closes #3886). Discussion ---------- Add PhpUnitMethodCasingFixer Closes #3302 ```diff class MyTest extends \PhpUnit\FrameWork\TestCase { - public function test_my_code() {} + public function testMyCode() {} } ``` - [x] Implement base fixer - [x] Take care of `@depends` - [x] Run after `PhpUnitTestAnnotationFixer` - [x] Deprecate `PhpUnitTestAnnotationFixer` *case* config Commits ------- b87f254 Add PhpUnitMethodCasingFixer
My proposal is a fixer that enforces either
or
for PHPUnit tests.
Ive seen the discussion in #1044, but i feel that reducing the scope of a fixer like this to only PHPUnit tests makes it safe to use.
Any helper functions or dataproviders and the like would not be affected by the fixer, only the tests (either prefixed with test or having a doc block containing
@test
.The fixer would only have to adjust the function names it finds, and function names in any
@depends
tags in doc blocks.If there is any desire for a fixer like this i'm willing to shoot a PR this way.
The text was updated successfully, but these errors were encountered: