The views module uses Test class members with underscored names. Some examples are big_user, web_user and admin_user, but there could be others. According to our coding conventions, these should be renamed to bigUser, webUser and adminUser. In addition, some properties are undefined but should be.
See the parent issue #1811638: [meta] Clean-up Test members - ensure property definition and use of camelCase naming convention.
Beta phase evaluation
| Issue category | Task, because this is a coding standards change. |
|---|---|
| Issue priority | Not critical because coding standard changes are not critical. |
| Unfrozen changes | Unfrozen because it only changes automated tests. |
| Disruption | There is no disruption expected from this sort of change. |
| Comment | File | Size | Author |
|---|---|---|---|
| #51 | clean_up_views_module-2385209-51.patch | 38.34 KB | ajits |
| #49 | interdiff-32-49.txt | 2.55 KB | ajits |
| #49 | clean_up_views_module-2385209-49.patch | 38.34 KB | ajits |
| #45 | clean_up_views_module-2385209-44.patch | 38.32 KB | ardnet |
| #41 | clean_up_views_module-2385209-39.patch | 37.5 KB | ardnet |
Comments
Comment #1
cilefen commentedComment #2
cilefen commentedComment #3
hussainwebInitial attempt.
Comment #4
mile23Found an underscore in Drupal\views\Tests\Handler\FieldWebTest:
1 out of 104 files isn't bad. :-)
Also made a video about how I did this review: http://youtu.be/H6pWz_6XoiQ :-)
Comment #5
tibbsa commentedThat video ought to be added to the Contributor task: Improve patch coding standards and documentation if you ask me.
Comment #6
tibbsa commentedOne has to wonder what purpose this variable serves if this test passed with the wrong variable name in the first place, but alas...
Comment #7
mile23My video above was a bit misleading on the analysis. It looks like a common pattern in the views tests to have a $column_map property on all the test classes. I'm not sure what the analysis would be on whether to keep or toss the one you just changed above. And it's out of scope to make such a change anyway. :-)
phpcs says there aren't any under_score errors any more, so RTBC. Woot.
Comment #9
subhojit777Comment #11
subhojit777Patch in #6 passed test. Code looks good according to camel case coding standard. Moving this to RTBC.
Comment #14
mile23Again with the fidgety testbot. RTBC from #7 for patch in #6 is renewed. Woot.
Comment #15
alexpottSometimes there is a conversion to the new array format and sometimes there is not. How come? Changing to the new format is okay in this patch since these lines are changing but let's be consistent.
These are out-of-scope changes.
Comment #16
tadityar commentedApplied suggested change from #15.
Comment #18
tadityar commenteder.. forgot to add ;
Comment #20
subhojit777This kind of array syntax sometimes fails, I guess something is wrong with testbot. alexpott has mentioned to keep the syntax consistent in #15, isn't it?
I think we should use
array()everywhere else. Rest of the child issues have this same syntax. See cilefen's comment here #2394419: Clean-up file module test members - ensure property definition and use of camelCase naming convention (comment)Comment #21
tadityar commentedreverted array style change.
Comment #22
tadityar commentedComment #24
hussainwebReverting all array syntax changes and found one more variable without a declaration.
Comment #25
mile23Tests pass and phpcs can't find any improper underscore names.
Thanks for removing the array changes.
Comment #26
alexpottclean_up_views_module-2385209-24.patch no longer applies.
Comment #27
cilefen commentedreroll
Comment #29
cilefen commentedComment #30
mile23Thanks for the reroll.
I still can't find any class property underscore errors in the tests.
Comment #31
alexpottNot necessary to by class properties since afaics they are not used. We should still add the role to the user.
Comment #32
cilefen commentedComment #34
subhojit777I would have marked it RTBC but there are some commented code in
ViewStorageTest.php, it can be out of scope. The code looks ok andegrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/views/src/Tests/returned no output.Comment #35
mile23Just added this for the commented code: #2413217: ViewStorageTest::displayMethodTests() needs @todo love.
I think we can agree this is RTBC. :-)
Comment #36
subhojit777Then its okay. RTBC +1 :)
Comment #37
alexpottDoes not need to be a property.
Does not need to be a property.
Comment #38
ardnet commentedComment #39
ardnet commentedComment #40
ardnet commentedComment #41
ardnet commentedComment #42
cilefen commented@ardnet Good work on your first patch! Here are some changes to make:
This should be removed completely.
References to $this->field_name should be simply $field_name because we are changing this to a variable in this function's scope.
References to $this->root_user in this method should be simply $root_user. Also remove the $root_user class property and its comment.
Comment #43
hussainweb@ardnet: I think there was some confusion. @alexpott didn't say to revert those property names like you have done in the interdiff. The properties are apparently not necessary at all and you can remove them, and their usage can be changed to local variable assignments.
Comment #45
ardnet commentedComment #46
cilefen commented@ardnet - It will be good if you keep posting interdiffs with your patches. Don't worry about it this time.
Remove this now-unused declaration.
I am not sure why you removed this. It will cause an error. Replace $this->field_name with $field_name instead.
Why did you remove this? You should replace $this->root_user with $root_user instead.
Comment #48
ajitsAssigning to myself
Comment #49
ajitsAttaching a patch as per @Alex's comment #37.
Comment #50
mile23+1 on making it a local variable, but -1 on leaving it as camelCase. It should be underscored, like this:
$field_nameSame deal here. Change
$rootUserto$root_user.Comment #51
ajitsDone!
Comment #52
mile23Great. :-)
Comment #54
hussainwebAnd I thought this would be a reroll. :)
I am not sure if this is a random fail but it is strange that it passed earlier and suddenly started failing. Retesting it. Should go back to RTBC as per #52.
Comment #57
alexpottCommitted 23a2db2 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #59
ajitsCool!