The block 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.
Files: 
CommentFileSizeAuthor
#4 clean_up_block_module-2381299-4.patch4.13 KBhussainweb
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 82,044 pass(es).
[ View ]
#4 interdiff-1-4.txt790 byteshussainweb

Comments

hussainweb’s picture

Status:Active» Needs review
StatusFileSize
new3.83 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 81,752 pass(es).
[ View ]

Attaching the changes for BlockCacheTest.php. I am not fixing the instance of $this->root_user in BlockHtmlTest.php because that is actually from \Drupal\simpletest\WebTestBase and changing there may not be in scope of this issue.

cilefen’s picture

Status:Needs review» Needs work

Thank you for working on this. It is good when we follow our own coding standards.

I agree on the root_user situation. We have to be sure it is considered when we fix the parent class.

+++ b/core/modules/block/src/Tests/BlockCacheTest.php
@@ -24,9 +24,9 @@ class BlockCacheTest extends WebTestBase {
+  protected $adminUser;
+  protected $normalUser;
+  protected $normalUserAlt;

Please comment these. Look around in other tests for what is usually used.

hussainweb’s picture

Status:Needs work» Needs review
StatusFileSize
new790 bytes
new4.13 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 82,044 pass(es).
[ View ]

Added comments.

tibbsa’s picture

+  /**
+   * A user with permission to create and edit books and to administer blocks.
+   *
+   * @var object
+   */
+

I suggest @var \Drupal\user\UserInterface rather than a very vague 'object' definition for these.

Mile23’s picture

Status:Needs review» Reviewed & tested by the community

The patch in #4 refactors class-level properties from under_score to camelCase as the coding standards demand.

I know this because I applied the patch, ran my own coding standards review with netbeansdrupalcomposed, and poked through all the test classes to find camel case and underscore violations.

alexpott’s picture

Status:Reviewed & tested by the community» Fixed

Committed aec18af and pushed to 8.0.x. Thanks!

  • alexpott committed aec18af on 8.0.x
    Issue #2381299 by hussainweb: Clean-up block module test members -...