Problem/Motivation

Found in #2464383: Remove CacheTestBase and merge its functionality into ClearTest

There is a reference to system_test_help in \Drupal\KernelTests\Core\Common\DrupalFlushAllCachesTest::testDrupalFlushAllCachesModuleList asserting that the function doesn't exist. Later in the test the system_test module is enabled and we assert that the SystemTestHook::help method does exist.

Steps to reproduce

Proposed resolution

Update the test to check if the module handler can find the hook implementation, rather than if the function or method exists.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3534371

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

mstrelan created an issue. See original summary.

guri221 made their first commit to this issue’s fork.

mstrelan’s picture

Status: Active » Needs work
Issue tags: -Novice

OK that test fail suggests this might not be a novice issue. IIRC there is another issue for ignoring hooks from modules that are not installed. This might be a duplicate of that.

sijumpk made their first commit to this issue’s fork.

sijumpk’s picture

Assigned: Unassigned » sijumpk
sijumpk’s picture

Assigned: sijumpk » Unassigned
Status: Needs work » Needs review

From the code context, it seems like the usage of that assert is to confirm system_test module is not installed. If there is an issue with checking hooks, then we can do the same assertion using module_handler's moduleExists function. Plz review the code.

smustgrave’s picture

Status: Needs review » Needs work

Summary doesn't appear to match the MR. Should check the issue the assert was added to see what the goal was.

mstrelan’s picture

The assertion was added in #2160091-61: drupal_rebuild() rebuilds container twice, since drupal_flush_all_caches() also rebuilds it (specifically comment #61). Have not reviewed closely, just identifying where it happened.

mstrelan’s picture

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

I guess since Hooks classes are now autoloaded unconditionally it doesn't make sense to check if a method exists. I've updated the test to check if the hook implementation exists instead.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for looking that up! Changes LGTM

sijumpk’s picture

  • catch committed a453294c on 11.x
    Issue #3534371 by guri221, mstrelan, sijumpk, smustgrave: Lingering...

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

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