Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #1811638: [meta] Clean-up Test members - ensure property definition and use of camelCase naming convention
This is for tests in core/tests.
Use this phpcs one-liner to aid in reviewing patches: https://gist.github.com/paul-m/bdb4c44ecd1de8f934cd
Beta phase evaluation
Issue category | Task because this is clean-up work. |
---|---|
Issue priority | Not critical because this is code style cleanup. |
Unfrozen changes | Unfrozen because it changes only tests. |
Comment | File | Size | Author |
---|---|---|---|
#26 | interdiff.txt | 1.1 KB | Mile23 |
#26 | 2463419_26.patch | 17.56 KB | Mile23 |
#23 | interdiff.txt | 2.04 KB | Mile23 |
#23 | 2463419_23.patch | 17.17 KB | Mile23 |
#21 | interdiff_19.txt | 2.48 KB | Mile23 |
Comments
Comment #1
Mile23A couple of properties of
CssOptimizerUnitTest
were unused. Other than that, very straightforward.Also:
Comment #2
jhodgdonPatch looks good to me. Issue needs beta evaluation though?
Comment #3
cilefen CreditAttribution: cilefen commentedComment #4
hussainwebI think we missed one.
Comment #5
jhodgdonThanks! As you can tell, I haven't run a grep or sniffer to see that there are not more problems, but everything in this latest patch still looks great.
Comment #6
cilefen CreditAttribution: cilefen commentedComment #7
rpayanmComment #8
rpayanmComment #9
cilefen CreditAttribution: cilefen commentedThank you @rpayanm. I have two suggestions:
"Whether the CSS cache was cleared."
"Whether the registry should be rebuilt."
Comment #10
rpayanm@cilefen hehe sorry about that, i am a native spanish and my english isn't so good :P
Comment #11
cilefen CreditAttribution: cilefen commentedWe need documentation for these since we are renaming them.
These are declared but never used?
I don't understand how TestThemeHandler::systemThemeList() ever works because ::systemList seems never to be set anywhere. Some of these class methods may be unused code.
Would "The log message parser for use in the test." be better here?
yaml should be YAML.
Comment #12
Mile23#11.1: Done.
#11.2: Yup. It happens. :-)
#11.3: TestThemeHandler is really a stub class, and should be renamed. I'm not sure how the interaction works with its superclass, so I'll just leave it.
#11.4: No, what would be better is not having that test dependency as a class property. :-)
#11.5: Done.
Comment #13
joelpittetCouple of nitpicks, but this one looks really close.
Any chance we can rename this to
$definitionReflection
? I thought it was a Reference at first glance.Might as well use short array syntax for these as they don't change the diff hunk.
Comment #14
Mile23Done.
Comment #15
joelpittetI think some things may have snuck in from another patch or did you mean to do this here?
Comment #16
Mile23You should
git pull origin 8.0.x
. :-)Comment #17
joelpittetOk maybe my question wasn't all that clear:
#12 didn't have that changed hunk in it. #14 has that hunk at the top but the comment was just 'Done' in #14. So I'm curious if you meant to do that change on purpose or did it accidentally come from another patch or maybe forgot a rebase?
If it was on purpose, please let us know why it was needed.
Comment #18
Mile23Ahh maybe I need a rebase. Thanks.
Comment #19
Mile23Trying again... Interdiff is from #12, not #14.
Comment #20
joelpittetThanks @Mile23. I see you renamed
$definitions_ref
to$ref_definitions
. What were ideas on that change?It kinda reads better to me but why not also
$reflection_definitions
?Comment #21
Mile23Thanks for reviewing these.
Here's another approach: Let's just use an anonymous function. If it's out of scope just ignore this patch and review #19. :-)
The
$ref_
prefix is easy to read and in wide use in D8 and the rest of the world to mean 'reflection object for _name'.Comment #22
joelpittetWe tend way from short variable names, like
$variables
instead of$vars
. Though no hard rule that I could find on it. And$ref
as I mentioned before is likely more common as "reference" and not "reflection".#21 Is ok with me as it's a nice cleanup (more compact way to deliver the test, nice work!) but a couple of notes on coding standards:
whitespace before the last ) should be removed.
This should be one line without the whitespace around the arguments.
Comment #23
Mile23In the context of a unit test, not so much. But no biggie.
Got the formatting stuff.
Comment #24
joelpittetBeauty, thanks, this looks like a great cleanup.
Comment #25
alexpottTo capitalize or not to capitalise?
This change subtly changes the nature of the test - before we were also testing that repeated calls to the same log parser had no effect on each other. Is this a desired change?
Comment #26
Mile23setUp()
is called before each test method. So a) It wasn't the same parser anyway, assuming more than one test method, and b) there's only one test method so it doesn't matter. Setting test dependencies as class properties is an anti-pattern you see all through D8, inherited from SimpleTest.Also: YAML CAPITALIZATION MODE: ACHIEVED!
Comment #27
joelpittetI believe the issues were addressed in #26 resetting to RTBC.
#25.1 If it is a desired test multiple calls to the same logger, it may be pertinent to make it explicit test case. Though I'd push for that to go in another issue.
25.2 Consistency is good, good catch @alexpott and uppercase is a good choice since it's an acronym.
Comment #28
alexpottCommitted 523b60b and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.