Problem/Motivation
Follow-up to #2926068-25: Deprecate system_rebuild_module_data() and remove usages in core, @alexpott's comment:
There is likely to be a few other KernelTests where this is the case. Let's file a followup to review all tests where system is the only dependency. There are 52 tests where this is the case. For example the same code can be removed from \Drupal\Tests\field\Kernel\FieldDefinitionIntegrityTest but not from \Drupal\KernelTests\Core\Theme\ThemeInstallerTest - so working through that in a follow-up makes sense to me.
This issue is to remove system module dependencies that were created in Kernel and Browser tests just to call system_rebuild_module_data() or some other deprecated method.
Steps to reproduce
N/A
Proposed resolution
Create an issue fork by clicking the button.
Follow the instructions to pull down the fork.
Search core for protected static $modules = ['system'];
If it is in a Kernel test delete the line.
Run the test locally
If it passes commit the change
If it fails undo the deletion
Note the test in the remaining tasks section for further investigation
Push up changes
Create MR
Set issue status to needs review
Remaining tasks
Fixes for the following tests as they don't work after removing the dependency:
- AddFeedTest
- BaseThemeRequiredTest
- ClaroVerticalTabsTest
- ConfigExistsConstraintValidatorTest
- ConfigImportThemeInstallTest
- DbDumpCommandTest
- DrupalFlushAllCachesTest
- ElementsFieldsetTest
- FileSystemRequirementsTest
- FloodTest
- FormattableMarkupKernelTest
- FormElementLabelTest
- FormElementMaxlengthTest
- ImageTest
- InstallerDependenciesResolutionTest
- MailerDsnConfigValidationTest
- MenuStorageTest
- MessageTest
- ModuleHandlerTest
- PendingUpdatesValidatorTest
- RouteNoneTest
- RouteProcessorCurrentIntegrationTest
- RunTimeRequirementsTest
- SimpleConfigValidationTest
- ThemeInstallerTest
- ThemeSettingsTest
- ToolkitGdTest
- TwigEnvironmentTest
The following one is an abstract class but probably needs to take the dependency out as well
- FileTestBase
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-2943436
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:
- 2943436-review-all-tests
changes, plain diff MR !13161
Comments
Comment #12
nicxvan commentedThis should be a pretty good novice task.
Comment #14
quietone commentedComment #15
luismagr commentedHi,
I'm going to go through the tests and add all the failed ones on the remaining task section when I finish so I only have to update the section once if that's ok.
Thanks
Comment #16
luismagr commentedComment #17
luismagr commentedHi all,
I've pushed to the Issue fork individual commits per test and updated the list of remaining tests to remove the dependency. From here, I'm not sure if we want to fix them under this issue or if we want to create individual issues for each one.
Thanks
Comment #18
luismagr commentedComment #19
quietone commented@luismagr, Can you make an MR so the tests run?
Comment #21
nicxvan commentedWhoops forgot this was novice and created the MR.
@luismagr great work so far! I created the MR in the future you can do that after pushing by clicking compare next to the branch on the issue then clicking create Merge request on the next page.
Comment #22
nicxvan commentedThis is green, I think a good final step world be to remove it from FileTestBase and see if any tests fail.
Comment #23
luismagr commentedThanks @quietone and @nicxvan
Understanding the workflow was the idea behind working on this issue. Will create it next time for sure. Thanks for creating it this time.
Thanks
Comment #24
luismagr commentedComment #25
luismagr commentedIt doesn't like the removal from FileTestBase. Shall we revert the commit or do we need to look at that change? Before the commit pipeline was green.
Comment #26
luismagr commentedAn example of running the test locally. I got this
I guess the dependency needs to be injected at some other point
Comment #27
nicxvan commentedYes let's revert that thank you.
Comment #28
luismagr commentedComment #29
luismagr commentedReverted the one failing and added it to the remaining tasks section. Now is green again
Comment #30
luismagr commentedBtw @nicxvan, is this issue now in "needs review" or is it panned to fix the remaining tests in this one?
Comment #31
nicxvan commentedI think this is almost ready.
I'm just considering if it's worth a follow up to track the remaining tests or of we need to verify the failing ones.
Honestly I think we are good as is, but I want to check.
It might be worth a followup for file test base.
It might be a week or so before I can dig in.
Comment #32
nicxvan commentedI think this is a good cleanup.
If someone wants a follow up we can create that, but shouldn't block this further.
To be clear the only one I think that would be good is file, but the filesystem is pretty intertwined with system.
Comment #33
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #34
nicxvan commentedRebased in the ui I'll keep an eye on tests.
Credit updated too.
Comment #35
mstrelan commentedI don't really understand the Remaining Tasks. Surely there are some tests that do need the system module? I think we could potentially have a follow up to find tests that have system plus some other modules and see which ones can have system removed.
Comment #36
mstrelan commentedOpened #3547124: Remove system module from kernel tests that don't need it for #35
Comment #39
catchNice to remove all that cruft.
Committed/pushed to 11.x, thanks!