Problem/Motivation

Now that almost all hooks can be OOP, .module files are only necessary when/ if they contain preprocess functions

Steps to reproduce

Open file

Proposed resolution

  • Move functions from the ajax_test_forms.module file into the Drupal\ajax_forms_test\Callbacks class.
  • Add a return type to the moved functions.

As part of this issue, we are going to convert all methods at Drupal\ajax_forms_test\Callbacks to static methods.

Remaining tasks

None

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3495959

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

nikolay shapovalov created an issue. See original summary.

nikolay shapovalov’s picture

Issue summary: View changes
nikolay shapovalov’s picture

Assigned: nikolay shapovalov » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: +Needs Review Queue Initiative

Ready for review.

smustgrave’s picture

It's a test but wonder if we should start using a Callback folder?

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Maybe a conversation for another issue. Since there are so many modules in system I just all the ones that started with ajax and these were the ones that needed conversion.

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

Any reason why these can't be static methods?

nikolay shapovalov’s picture

Assigned: Unassigned » nikolay shapovalov
Status: Needs review » Needs work

You are right.
It looks like most of the callbacks methods should be converted to static.

nikolay shapovalov’s picture

Assigned: nikolay shapovalov » Unassigned
Status: Needs work » Needs review

Existing methods at Callbacks are not static, this is the reason I decide to use non static methods, to keep code consistent, I think we can create follow up to convert methods to static and add return type hint. I revert recent changes I made. And set back to NR.

smustgrave’s picture

Status: Needs review » Needs work

Since we are dealing with just tests that think it could be in scope of during the conversion to make static here vs another issue.

nikolay shapovalov’s picture

Issue summary: View changes
Status: Needs work » Needs review

All methods at Drupal\ajax_forms_test\Callbacks converted to static and added return type hints. MR is ready for review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good to me.

  • catch committed d5612c53 on 11.x
    Issue #3495959 by nikolay shapovalov, smustgrave, larowlan: Move helpers...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Only used internally to the test module so we don't need to worry about a bc layer. Approach looks fine to me. Committed/pushed to 11.x, thanks!

  • catch committed 6e30fe2f on 11.x
    Revert "Issue #3495959 by nikolay shapovalov, smustgrave, larowlan: Move...
catch’s picture

Status: Fixed » Needs work

Looks like this broke HEAD:https://git.drupalcode.org/project/drupal/-/jobs/4115231

Reverted for now.

nicxvan changed the visibility of the branch 3495959-ajax_forms_test to active.

nicxvan changed the visibility of the branch 11.x to hidden.

nicxvan changed the visibility of the branch 3495959-ajax_forms_test to hidden.

nicxvan’s picture

I don't think I have permission to reopen the MR so I pulled it down, rebased on 11.x and pushed up a copy so I could create the MR.

Since I was doing that I also reviewed the MR. If it's green I think I can RTBC since the rebase was clean and I didn't write this one.

nicxvan’s picture

Status: Needs work » Reviewed & tested by the community
quietone’s picture

@nicxvan, just ask in #core-development for help re-opening an MR. Someone is often around.

Why did this break HEAD and has it been fixed?

catch’s picture

Status: Reviewed & tested by the community » Fixed

@quietone not sure but it may have just been a cross-commit with something else where they passed individually and failed when combined. We have a lot of 1+ month MRs in the RTBC queue so the chances of that happening are quite high. It happened with at least one other issue too. When we're using gitlab issues, we'll be able to set up merge trains so that each merge gets a full pipeline run before it actually goes in against the current state of HEAD.

Since the rebase is green, going to try this again but also keep an eye on gitlab in case we need to revert again.

  • catch committed 38de8a6c on 11.x
    Issue #3495959 by nikolay shapovalov, nicxvan, smustgrave, catch,...
godotislate’s picture

HEAD seems to be broken again with 38de8a6c.

nicxvan’s picture

Where are you seeing that?

Is it a new random fail?

godotislate’s picture

In my MR for another issue: https://git.drupalcode.org/issue/drupal-3416819/-/pipelines/405059/test_...

Also testing locally latest 11.x fails. I have pushed up MR with the fix, but it's concerning that tests were passing earlier.

ETA. Not sure if it's related to #3494332: Functional Javascript tests are silently skipped on Gitlab CI due to selenium standalone configuration

godotislate’s picture

Status: Fixed » Needs review

Pushed up MR 11001 with the fix. The test only job is passing erroneously, which is probably #3494332: Functional Javascript tests are silently skipped on Gitlab CI due to selenium standalone configuration.

Never mind - test only job includes the test fix, so that's why it's passing.

oily’s picture

Title: Move helpers in ajax_forms_test.module and delete it » Move helpers out of ajax_forms_test.module and delete the file
Issue summary: View changes
nicxvan’s picture

Oh good catch, why was it passing without it though?

godotislate’s picture

Oh good catch, went was it passing without it though?

Yes, it's very concerning if functional javascript tests have false negatives on MR builds.

oily’s picture

@godotislate I experienced this on another issue and @berdir had a solution.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I did another careful review of the merged MR and confirmed that this was incorrectly converted, and that MR 11001 fixes that. I also confirmed that no other functions were incorrectly mapped to their corresponding methods.

RTBC

Also @quietone, I'll keep that in mind in the future! Honestly it really was no trouble, it's just a couple of extra commands to create a new branch and push it up.

nikolay shapovalov’s picture

MR 11001 looks like good fix. @godotislate thanks.
+1 for RTBC

Yes, it's very concerning if functional javascript tests have false negatives on MR builds.

I think this false positive. Tests passes but it should fail.

@nicxvan thanks for double check original MR 10676, and also found nothing else, but this.

  • catch committed 542a5a53 on 11.x
    Issue #3495959 by nikolay shapovalov, nicxvan, smustgrave, catch,...

catch’s picture

Bumped #3494332: Functional Javascript tests are silently skipped on Gitlab CI due to selenium standalone configuration to critical, tests were passing multiple times both on here and branch runs when they should have failed.

Committed/pushed the latest MR to 11.x, thanks for tracking it down.

nicxvan’s picture

Thanks!

Godotislate should be credited I think though.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Ahh sorry too many things, also didn't mark it fixed...

Status: Fixed » Closed (fixed)

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

nicxvan’s picture