The system 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

Reference: https://www.drupal.org/core/beta-changes
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.
CommentFileSizeAuthor
#74 2389455_74.patch115.58 KBMile23
#73 clean_up_system_module-2389455-73.patch115.57 KBAjitS
#71 clean_up_system_module-2389455-71.patch115.74 KBhussainweb
#71 interdiff.txt905 byteshussainweb
#69 clean_up_system_module-2389455-69.patch115.16 KBhussainweb
#65 2389455_64.patch113.75 KBMile23
#63 clean_up_system_module-2389455-63.patch115.14 KBAjitS
#63 interdiff-60-63.txt632 bytesAjitS
#60 clean_up_system_module-2389455-60.patch115.15 KBAjitS
#60 interdiff-55-60.txt667 bytesAjitS
#55 clean_up_system_module-2389455-55.patch114.5 KBAjitS
#55 interdiff-53-55.txt2.5 KBAjitS
#53 clean_up_system_module-2389455-53.patch112.81 KBAjitS
#53 interdiff-51-53.txt4.72 KBAjitS
#51 clean_up_system_module-2389455-51.patch109.74 KBAjitS
#47 clean_up_system_module-2389455-47.patch109.59 KBAyesh
#39 clean_up_system_module-2389455-39.patch114.34 KBhussainweb
#37 clean_up_system_module-2389455-37.patch114.37 KBhussainweb
#31 clean_up_system_module-2389455-31.patch114.28 KBhussainweb
#24 clean_up_system_module-2389455-24.patch113.5 KBhussainweb
#16 clean_up_system_module-2389455-16.patch113.7 KBsubhojit777
#15 clean_up_system_module-2389455-15.patch113.5 KBhussainweb
#13 clean_up_system_module-2389455-8.patch113.54 KBsubhojit777
#8 clean_up_system_module-2389455-7-8-interdiff.txt21.48 KBtibbsa
#8 clean_up_system_module-2389455-8.patch113.54 KBtibbsa
#7 interdiff.txt2.41 KBMile23
#7 2389455_7.patch92.52 KBMile23
#5 interdiff.txt4.95 KBMile23
#5 2389455_5.patch94.18 KBMile23
#1 2389455_1.patch99.13 KBMile23
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mile23’s picture

FileSize
99.13 KB

phpcs tells me that there are 293 files with coding standards errors.

I went through all of them with netbeansdrupalcomposed and looked for underscore errors and refactored them to be camelCase.

When I found a var declaration (not @var, but var), I changed it to public or protected, based on the outcome running the test.

MailTest had an unused private static property called sent_message which I deleted.

Status: Needs review » Needs work

The last submitted patch, 1: 2389455_1.patch, failed testing.

Mile23’s picture

Well that certainly didn't work.

Try try again...

Mile23’s picture

Status: Needs work » Needs review
FileSize
94.18 KB
4.95 KB

Reverted all files not in core/modules/system/src/Tests. NetBeans must have burped on them.

Status: Needs review » Needs work

The last submitted patch, 5: 2389455_5.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
92.52 KB
2.41 KB

A few false-positives and a few false-negatives, and a var that should have been public instead of protected.

Also a rebase since JavaScriptTest.php is now history.

tibbsa’s picture

FileSize
113.54 KB
21.48 KB

Some more camelCasing, some undeclared vars, and the removal of a bunch of web_user/admin_user properties that served no purpose.

Status: Needs review » Needs work

The last submitted patch, 8: clean_up_system_module-2389455-8.patch, failed testing.

subhojit777’s picture

Assigned: Unassigned » subhojit777
subhojit777’s picture

Issue tags: +Needs reroll
subhojit777’s picture

Assigned: subhojit777 » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
113.54 KB

Patch rerolled

hussainweb’s picture

@subhojit777: I think you uploaded the same patch as #8 again.

hussainweb’s picture

This is a reroll of #8. I think #13 was the same patch as #8 as I couldn't apply it manually.

subhojit777’s picture

man!!! I rerolled the patch but didnt obtained the diff, and uploaded the old one. Here is the rerolled patch that should have been uploaded in #13

hussainweb’s picture

The patch in #16 is not a correct reroll as it brings back a property which was removed in HEAD (hence the conflict). See the current source of ThemeTest.php and you will find that the property $strictConfigSchema is not there, nor in the patch in #8. That patch only adds the $adminUser property whereas the patch in #16 adds two.

The last submitted patch, 13: clean_up_system_module-2389455-8.patch, failed testing.

The last submitted patch, 15: clean_up_system_module-2389455-15.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 16: clean_up_system_module-2389455-16.patch, failed testing.

The last submitted patch, 16: clean_up_system_module-2389455-16.patch, failed testing.

Mile23’s picture

Just in case anyone needs it, here's how to do a reroll: https://www.drupal.org/patch/reroll

It's really rather amazing that with patches of this size, the only changes between #15 and #16 are these:

$ diff clean_up_system_module-2389455-15.patch clean_up_system_module-2389455-16.patch 
2046c2046
< index 80d469a..ea03ed6 100644
---
> index 80d469a..0218333 100644
2049c2049
< @@ -19,6 +19,13 @@
---
> @@ -19,6 +19,22 @@
2052a2053,2061
> +   * Set to TRUE to strict check all configuration saved.
> +   *
> +   * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
> +   *
> +   * @var bool
> +   */
> +  protected $strictConfigSchema = TRUE;
> +
> +  /**
2063c2072
< @@ -30,8 +37,8 @@ protected function setUp() {
---
> @@ -30,8 +46,8 @@ protected function setUp() {
2074c2083
< @@ -215,7 +222,7 @@ function testAdministrationTheme() {
---
> @@ -215,7 +231,7 @@ function testAdministrationTheme() {

So apparently #16 only adds that docblock.

Let's re-test #16 and see if the testbot still barks at us. Then we can move forward from there.

Status: Needs work » Needs review
hussainweb’s picture

@Mile23: Yes, it seems like a random failure. And it's not just a docblock, but also a property definition which was removed in HEAD but came back because of the conflict. I will attach patch in #15 again to avoid confusion. I have named it 24 to keep it consistent but it is the same patch as #15.

subhojit777’s picture

Status: Needs review » Reviewed & tested by the community

Go this result on execution of command egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/system/src/Tests/

core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
core/modules/system/src/Tests/Image/ToolkitGdTest.php
core/modules/system/src/Tests/System/DateFormatsLockedTest.php
core/modules/system/src/Tests/File/HtaccessUnitTest.php
core/modules/system/src/Tests/File/ConfigTest.php
core/modules/system/src/Tests/Installer/InstallerTest.php
core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php
core/modules/system/src/Tests/Installer/DistributionProfileTest.php
core/modules/system/src/Tests/Update/UpdateScriptTest.php
core/modules/system/src/Tests/Session/SessionTest.php

Manually checked those files but variables with underscores were only local variables, so no problem with that. Patch looks good and applied cleanly on the HEAD.

Moving this to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: clean_up_system_module-2389455-24.patch, failed testing.

Status: Needs work » Needs review
hussainweb’s picture

It was a random failure - database connection failed.

hussainweb’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC as per #25 after random fail.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: clean_up_system_module-2389455-24.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
114.28 KB

Rerolling

Mile23’s picture

I would RTBC this but it's my issue and I wrote some of the code.

Still though, phpcs says there aren't any test class property camel case issues.

Status: Needs review » Needs work

The last submitted patch, 31: clean_up_system_module-2389455-31.patch, failed testing.

tibbsa’s picture

Issue tags: +Needs reroll

Have to look back at this and see what is going on. I could not find a previous commit to which patch #31 would apply, so there might be something funky with that.

hussainweb’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
114.37 KB
Mile23’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

You'll never guess.... It needs a reroll.

hussainweb’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
114.34 KB

Guess what? I rerolled again. :P

hussainweb’s picture

The last RTBC was over a month ago as per #25. I am letting it be to Needs review as lot might have changed.

Mile23’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Yup, needs a reroll again.

piyuesh23’s picture

Issue tags: +#DCM2015
Ayesh’s picture

Assigned: Unassigned » Ayesh

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 39: clean_up_system_module-2389455-39.patch, failed testing.

Mile23’s picture

Yup, that's what 'needs reroll' means. :-)

You can find out if the patch applies by trying to apply it. Re-testing means we lose the information that it passed at a certain date, which makes it harder to reroll.

Ayesh’s picture

Assigned: Ayesh » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
109.59 KB

Sorry about that, Mile23.
Attached is a rerolled one that applies to 8.0.x.

Status: Needs review » Needs work

The last submitted patch, 47: clean_up_system_module-2389455-47.patch, failed testing.

AjitS’s picture

Assigned: Unassigned » AjitS

working on it now

AjitS’s picture

Issue tags: +Needs reroll

The patch is no longer applicable. Will have to reroll it first.

AjitS’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
109.74 KB

Seeing if the testbot is able to apply the patch. Will resolve the errors from #47 after that.

Status: Needs review » Needs work

The last submitted patch, 51: clean_up_system_module-2389455-51.patch, failed testing.

AjitS’s picture

Status: Needs work » Needs review
FileSize
4.72 KB
112.81 KB

Tried to cover all the errors mentioned. Finger's crossed!

Status: Needs review » Needs work

The last submitted patch, 53: clean_up_system_module-2389455-53.patch, failed testing.

AjitS’s picture

Status: Needs work » Needs review
FileSize
2.5 KB
114.5 KB

Hope, I am doing it right this time :-)

Status: Needs review » Needs work

The last submitted patch, 55: clean_up_system_module-2389455-55.patch, failed testing.

Status: Needs work » Needs review
AjitS’s picture

The test passes at local, giving it another try.

Status: Needs review » Needs work

The last submitted patch, 55: clean_up_system_module-2389455-55.patch, failed testing.

AjitS’s picture

Status: Needs work » Needs review
FileSize
667 bytes
115.15 KB

I am not sure why the test is failing. I did a quick egrep -rl '\$this\->[a-z]+_[a-z_]+' core/modules/system/src/Tests/ and found out the one file was missed out from the implementation.
I do not think if that was causing the test to fail, but I think it will be worth trying to fix it.

Status: Needs review » Needs work

The last submitted patch, 60: clean_up_system_module-2389455-60.patch, failed testing.

Berdir’s picture

+++ b/core/modules/system/src/Tests/Update/UpdateScriptTest.php
@@ -23,17 +23,29 @@ class UpdateScriptTest extends WebTestBase {
-    $this->update_url = $GLOBALS['base_url'] . '/update.php';
-    $this->update_user = $this->drupalCreateUser(array('administer software updates', 'access site in maintenance mode'));
-    // Make sure updates for new entity type definitions are processed.
-    \Drupal::service('entity.definition_update_manager')->applyUpdates();
+    $this->updateUrl = $GLOBALS['base_url'] . '/update.php';
+    $this->updateUser = $this->drupalCreateUser(array('administer software updates', 'access site in maintenance mode'));

You lost a line here in the test, that's causing those test fails. Probably a merge that went wrong.

Hint: Review patches like this with "git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'" ( I have an alias for this), that makes it much easier to catch the difference there.

AjitS’s picture

Status: Needs work » Needs review
FileSize
632 bytes
115.14 KB

@Berdir Thank you for the review! And also for the tip on reviewing, very helpful. I have also created an alias for the same, and will use it from now on.

Retrying the patch after adding the missed line.

AjitS’s picture

Assigned: AjitS » Unassigned

Ta Da! It feels so good! Hope this goes through. I will make any changes suggested.

Mile23’s picture

FileSize
113.75 KB

Thanks for sticking with it, @AjitS! :-)

Needed a reroll, thanks to changes in EntityCacheTagsTestBase.

Just a reminder that you can use a phpcs one-liner like this one to review patches in this meta: https://gist.github.com/paul-m/bdb4c44ecd1de8f934cd

And according to that, there are no more underscore/camel case errors within the scope of this issue.

Consider this RTBC if the testbot is happy.

Status: Needs review » Needs work

The last submitted patch, 65: 2389455_64.patch, failed testing.

Mile23’s picture

Clearly I got it wrong on EntityCacheTagsTestBase.

hussainweb’s picture

Assigned: Unassigned » hussainweb
Issue tags: +DrupalSouth

Looking into this. @Mile23, are you still looking at this? I checked on IRC but couldn't find you.

hussainweb’s picture

Assigned: hussainweb » Unassigned
Status: Needs work » Needs review
FileSize
115.16 KB

Trying a reroll from #63 again.

Status: Needs review » Needs work

The last submitted patch, 69: clean_up_system_module-2389455-69.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
905 bytes
115.74 KB

Fixing the failure.

Mile23’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Sigh... :-)

AjitS’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
115.57 KB

Rerolling. Hope this finds its way in soon!

Mile23’s picture

FileSize
115.58 KB

Reroll from #73.

Mile23’s picture

Status: Needs review » Reviewed & tested by the community

Setting RTBC so the maintainers can end this death march. :-)

If the test fails, it should set to 'needs work.'

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed f0c731f and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

+++ b/core/modules/system/src/Tests/Cache/ClearTest.php
@@ -17,8 +17,8 @@
 class ClearTest extends CacheTestBase {

Let's get a followup to remove CacheTestBase and merge its functionality into ClearTest.

Also someone should have created followups to document the undocumented properties.

  • alexpott committed f0c731f on 8.0.x
    Issue #2389455 by hussainweb, AjitS, Mile23, subhojit777, tibbsa, Ayesh...
hussainweb’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.