Problem/Motivation

Working to enable the sniff Drupal.Commenting.FunctionComment.Missing.

Steps to reproduce

Proposed resolution

Fix this sniff for hook related module tests
Add/improve comments in core/tests/Drupal/KernelTests/Core/Hook/HookAlterOrderTest.php and core/tests/Drupal/KernelTests/Core/Hook/HookOrderTest.php

Remaining tasks

Add comments for [A-D]AlterHooks.php and [A-D]Hooks.php
Review

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3540756

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quietone created an issue. See original summary.

quietone’s picture

Assigned: Unassigned » quietone

Leave this to me for a week or two, thanks.

quietone’s picture

Title: Fix Drupal.Commenting.FunctionComment.Missing in hook test module fixtures » Fix Drupal.Commenting.FunctionComment.Missing in HookOrder test module
Status: Postponed » Active
quietone’s picture

Assigned: quietone » Unassigned
quietone’s picture

Issue summary: View changes
Status: Active » Needs review

the scope expanded a bit to include core/tests/Drupal/KernelTests/Core/Hook/HookAlterOrderTest.php and core/tests/Drupal/KernelTests/Core/Hook/HookOrderTest.php. These are the tests using the files in [A-D]AlterHooks.php and [A-D]Hooks.php, anmd it made sense to update them as I figured what the tests were doing.

quietone’s picture

nicxvan and donquixote, thanks for the comments in Slack about this.

Your are correct that the commenting is rather explicit and sometimes repetitive. This is the first time I have looked closely at these tests and I added notes as I went through each to help me keep track of what was going on. Key for me was adding the 'default' ordering in the test doc block followed by a list of the ordering/removal operations. That made a huge difference to understanding each test. At the same time I had notes on each hook implementation noting where it got changed. That helped to see how all the hooks in a module 'fit' into a test. Then I tidied all those notes into comments.

The typo for 'its' has been fixed.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

As mentioned in 7 I reviewed this and discussed in slack, just took another look and all feedback has been addressed.

It's a bit repetitive, but so is the actual test an implementations.

These are really hard to keep straight so the extra documentation is super helpful for tracking the expected order.

longwave’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

These tests have always been very confusing, so adding the explicit explanations really helps. I read through the diff and they all make more sense than before!

Committed and pushed d211b2521f9 to 11.x and 484b56abd13 to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed 484b56ab on 11.3.x
    docs: #3540756 Fix Drupal.Commenting.FunctionComment.Missing in...

  • longwave committed d211b252 on 11.x
    docs: #3540756 Fix Drupal.Commenting.FunctionComment.Missing in...

quietone’s picture

I am glad to see this committed. It was challenging and time consuming to add the comments especially as I have not been involved in the many hook conversion issues. From my perspective, this is a good example of a case where test methods should be documented before commit.

nicxvan’s picture

In general I agree, but we made a couple of attempts in the original issue and we couldn't get consensus on the best way so we decided to do it in a follow up, sorry I missed creating it and thank you for pushing this across.

I just took a peek at the originating issue to see if I could find the discussion, but I couldn't find it in the 923MR comments lol.

Status: Fixed » Closed (fixed)

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