Posted by GPrince17 on
The text 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. |
Files:
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3.28 KB | areke | |
| PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 82,031 pass(es). [ View ] | |||
Comments
Comment #1
GPrince17 commentedComment #2
GPrince17 commentedComment #4
pwolanin commentedLooks like you missed a usage in TextFieldTest.php line 115
Comment #5
cilefen commentedComment #6
cilefen commented@GPrince17: See the update to the parent issue.
Comment #7
cilefen commentedComment #8
cilefen commentedComment #9
hussainweb commentedThe error was probably due to changing
web_usertowebUser. I have changed it in the parent classStringFieldTestwhich is in field module. It is not strictly in the scope of this ticket, but it is a small enough change rather than setting up dependencies to the issue for field module's ticket. We will just need to do a simple reroll depending on which goes in first. There is no issue yet for fixing these issues in the field module, which means we should be fine.Comment #10
subhojit777 commentedCode looks good. Marking this as RTBC for now.
Comment #11
subhojit777 commentedI am very sorry. This issue needs work.
egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/text/src/Tests/core/modules/text/src/Tests/TextFieldTest.php
Comment #12
tibbsa commentedThat's odd. With this patch applied here, that command does not turn anything up for me.
$ git checkout -b text-testSwitched to a new branch 'text-test'
$ git apply -v ./clean_up_text_module-2380411-9.patch
Checking patch core/modules/field/src/Tests/String/StringFieldTest.php...
Checking patch core/modules/text/src/Tests/TextFieldTest.php...
Applied patch core/modules/field/src/Tests/String/StringFieldTest.php cleanly.
Applied patch core/modules/text/src/Tests/TextFieldTest.php cleanly.
$ egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/text/src/Tests/
$
The only thing I could think that might trip this up (though the regexp should keep it from happening) are things like this, but this is valid:
$entity->{$field_name}->value = str_repeat('x', $i);Are you sure you tested against a patched copy?
Comment #13
subhojit777 commentedWill recheck it again today. Was a bit sleepy when I was testing this :-)
Comment #14
tibbsa commentedComment #15
areke commentedMarking as RTBC. As tibbsa suggested, I don't think subhojit777 had applied the patch before searching for the text.
$ egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/text/src/Tests/core/modules/text/src/Tests//TextFieldTest.php
$ git apply -v clean_up_text_module-2380411-9.patch
Checking patch core/modules/field/src/Tests/String/StringFieldTest.php...
Checking patch core/modules/text/src/Tests/TextFieldTest.php...
Applied patch core/modules/field/src/Tests/String/StringFieldTest.php cleanly.
Applied patch core/modules/text/src/Tests/TextFieldTest.php cleanly.
$ egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/text/src/Tests/
$
Comment #16
cilefen commented@areke: Thanks for reviewing. I have not checked this yet. Did you make sure all properties are declared and documented?
Comment #17
cilefen commentedadminUser and webUser are not documented.
Comment #18
areke commentedAdded documentation as per #17.
Comment #19
tibbsa commentedStrictly speaking this should probably have...
* @var \Drupal\user\UserInterface... for each of the docblocks as well.
Comment #20
areke commentedAdded the fixes to the errors mentioned in #19.
Comment #21
tibbsa commentedAlmost. :)
$ git apply -v clean_up_text_module-2380411-20.patchclean_up_text_module-2380411-20.patch:13: trailing whitespace.
* @var \Drupal\user\UserInterface
Checking patch core/modules/field/src/Tests/String/StringFieldTest.php...
Checking patch core/modules/text/src/Tests/TextFieldTest.php...
Applied patch core/modules/field/src/Tests/String/StringFieldTest.php cleanly.
Applied patch core/modules/text/src/Tests/TextFieldTest.php cleanly.
warning: 1 line adds whitespace errors.
Coding standards - Indenting and Whitespace
Comment #22
areke commentedDid I get it this time? :P
Comment #23
tibbsa commentedComment #24
alexpott commentedCommitted 86ced51 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation for to the issue summary.