Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
help.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Apr 2025 at 00:34 UTC
Updated:
2 Jun 2026 at 05:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
mstrelan commentedAdded an MR against
3390193-add-drupalget-with-mink-to-kerneltestbasebut since it's against that branch it doesn't appear on the issue page, and the pipelines don't work. But I did it this way so we can see only the changes to Help module and not all the changes in the parent issue.https://git.drupalcode.org/issue/drupal-3517299/-/merge_requests/1
It was a little annoying having to deal with the fact that we can't perform multiple requests in the same test, but overall it's still faster for the cases that I split. My test times below:
MySQL
ExperimentalHelpTest - Kernel 6.348s, Functional 13.550s
HelpBlockTest - Kernel 8.376s, Functional 13.642s
HelpPageOrderTest - Kernel 3.216s, Functional 14.067s
HelpPageReverseOrderTest - Kernel 3.212s, Functional 13.407s
NoHelpTest - Kernel 7.468s, Functional 15.771s
Total: Kernel 28.62s, Functional 70.437s
MySQL w/ tmpfs
ExperimentalHelpTest - Kernel 3.396s, Functional 6.374s
HelpBlockTest - Kernel 4.992s, Functional 5.254s
HelpPageOrderTest - Kernel 1.686s, Functional 5.254s
HelpPageReverseOrderTest - Kernel 1.700s, Functional 5.404s
NoHelpTest - Kernel 3.574s, Functional 5.754s
Total: Kernel 15.348, Functional 28.04s
So for MySQL with a normal filesystem this is a massive improvement! For tmpfs it's a decent improvement for the tests that only had one drupalGet, but it's much less of an improvement when the test had to be split and we repeat the setup tasks. It might be worth waiting for #2708827: Allows DrupalKernel::handle to handle more than one requests (rough support for PHP-PM) for those tests.
Comment #4
mstrelan commentedI investigated the multiple requests issue a little further, and it turns out the only issue is that the paths weren't prefixed with a preceding slash, so the path was appended to the path of the previous request resulting in 404s. After fixing those the updated timing is below.
MySQL
ExperimentalHelpTest - Kernel 3.246s, Functional 13.550s
HelpBlockTest - Kernel 2.818s, Functional 13.642s
HelpPageOrderTest - Kernel 3.216s, Functional 14.067s
HelpPageReverseOrderTest - Kernel 3.212s, Functional 13.407s
NoHelpTest - Kernel 3.831s, Functional 15.771s
Total: Kernel 16.323s, Functional 70.437s
MySQL w/ tmpfs
ExperimentalHelpTest - Kernel 1.739s, Functional 6.374s
HelpBlockTest - Kernel 1.634s, Functional 5.254s
HelpPageOrderTest - Kernel 1.686s, Functional 5.254s
HelpPageReverseOrderTest - Kernel 1.700s, Functional 5.404s
NoHelpTest - Kernel 1.754s, Functional 5.754s
Total: Kernel 8.513s, Functional 28.04s
Those numbers make this much more compelling.
Comment #5
dwwThanks for doing a trial run like this! Very helpful and encouraging that the parent issue is on the right track.
If a branch off an issue branch confuses the tooling so much, probably not the end of the world to have an initial commit of #3390193: Add a drupalGet() method to KernelTestBase in here, no? The changes tab will be bloated, but it should be fairly simple to review changes via each proceeding commit...
Anyway, thanks again!
Comment #7
mstrelan commented@dww sure, I've created an MR against 11.x. As a bonus you don't have to review it one commit at a time because all the changes are limited to the help module, other than a7f43433.
Comment #8
mstrelan commentedAdded 2 more, HelpTest and HelpTopicTest, both of this are much faster now but I don't have the numbers. I did have a go at HelpTopicsSyntaxTest but it was actually significantly slower!
Comment #9
joachim commented> and it turns out the only issue is that the paths weren't prefixed with a preceding slash, so the path was appended to the path of the previous request resulting in 404s
Can you explain a bit more about where this path appending thing happens? Is it something we can maybe fix?
Though OTOH, since the Drupal convention is now that paths should have the initial slash, it's probably a good thing to add that consistently.
I've had a look at your patch on the other issue for converting BlockContentPageViewTest. I'm honestly confused by what this failing test is doing anyway:
Why would the block report as being broken? What's causing it to be broken? This test needs to explain what it is doing!
Comment #10
mstrelan commentedI'm offline for over a week now but when from what I recall you can see it in the html output for ExperimentalHelpTest if you remove the slash and run the test. Didn't look at what was causing it.
IIRC there is a test module that includes config for a block, but that block is referencing the uuid of a block content entity that doesn't exist. Couldn't tell you why, but it's not really relevant. I think let's ignore that test for now.
Comment #12
catchComment #13
joachim commentedRebased.
I had to remove history module from being installed in one test, but it made no difference to the test at all!?!?
HelpTopicTest isn't working, and the error is to do with how the Help module or Twig is outputting inline links.
Comment #14
joachim commentedThe problem is
in HelpTwigExtension.
Comment #15
joachim commentedFiled #3582382: absolute links don't work in Kernel tests.
We could skip HelpTopicTest for now to get this in.
Comment #16
joachim commentedTrying to see if #3582386: remove absolute from HelpTwigExtension links works.
Comment #17
joachim commentedI don't understand why we need to add this to drupalGet():
UiHelperTrait::drupalGet() doesn't have it.
Comment #18
joachim commentedWe probably should switch from using AssertContentTrait methods to using Mink methods as part of the conversion.
Comment #19
dwwRe: #17 and #18: While I appreciate the desire for elegance and simplicity in the new trait, I'd strongly vote in favor of doing whatever we can to minimize the changes necessary to convert something from Functional to Kernel. If we have to update a ton of assertions, it's going to massively slow down conversions, bog down reviewers, require more cognitive load, etc. That 1 line (and minor waste of RAM while the test is running, if I understand correctly) seems like it'll save a ton of effort. So IMHO, I'd sacrifice a little elegance for easier conversions.
Thanks!
-Derek
Comment #20
joachim commentedI'm not totally against adding
$this->content = $outbut aren't PHPStan/PHPCS going to complain about a trait setting a property it doesn't have?Comment #21
mstrelan commentedPhpstan analyses traits in the context of the class that uses them, it's essentially flattened before it's analysed.
Comment #22
joachim commented#3582580: add checkForMetaRefresh() method to HttpKernelUiHelperTrait is adding the setting of $this->content.
Comment #23
joachim commentedAdding clickLink in #3582769: Add clickLink() to HttpKernelUiHelperTrait, changing this MR accordingly.
Comment #24
joachim commentedWe should add these to the main trait in a separate issue:
Comment #25
joachim commentedRebased, and updated for changes in #3582985: Add content from HttpKernelUiHelperTrait::drupalGet() to $this->content for use by AssertContentTrait.
Comment #26
joachim commentedComment #27
dwwRe #24: I opened #3583594: Add getUrl() and (renamed) xpath() helpers to HttpKernelUiHelperTrait but the pipeline in there fails all Kernel tests with a conflicting
xpath()method in both traits. Seems #3582985: Add content from HttpKernelUiHelperTrait::drupalGet() to $this->content for use by AssertContentTrait is the better solution, then we don't need a separate copy ofxpath(). Then that would leave #3583594 to only add thegetUrl()method. As I wrote over there, maybe we should merge all these follow-ups to be easier to manage, coordinate, and hopefully backport?Comment #28
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. 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 #29
joachim commentedRebased and fixed baseline issue.
Comment #30
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 #31
joachim commentedRebased.
Comment #32
smustgrave commentedShould the MR still be in draft?
Comment #33
smustgrave commentedActually should this be postponed on #3191278: Use plugin id to make help section headers HTML IDs ?
Comment #34
joachim commentedIf that gets in first, it's going to be a nightmare to rebase this MR, because the files are moved.
Comment #35
smustgrave commentedSo the issue in #33 is RTBC and more then likely will land first. Vs making it a competition lets just postpone this as I feel that one is slightly more important, not to down play these conversions but the tests are there so nothing is lost. If that makes sense.
Comment #36
alexpott@smustgrave please don't postpone - we don't need to - resolve git conflicts is part of working together and are not horrible.
Comment #37
alexpottAnd git correct merged the assertions. - I did not even need to do anything.
Comment #38
smustgrave commentednoted
Comment #39
smustgrave commentedOnly functional test that remains are upgrade tests and HelpTopicTranslationTest. I'm assuming HelpTopicTranslationTest has to remain as it does does a drupalLogin(). Rest looks good.
Comment #40
catchI think we need to decide what to do about the xpath etc. methods in #28 - go ahead here then update the test once one of those issues is in, or wait for one of those to land. I don't have a strong preference as long as we end up in the same place, but moving back to needs review for that.
Comment #41
smustgrave commented@catch you mean #3583594: Add getUrl() and (renamed) xpath() helpers to HttpKernelUiHelperTrait that is RTBC maybe it could be committed and used here?
Comment #42
smustgrave commentedNow that #3583594: Add getUrl() and (renamed) xpath() helpers to HttpKernelUiHelperTrait I'm assuming catch you wanted to see that used here somewhere?
Comment #43
mstrelan commentedI worked on this at DrupalSouth contribution day. Have rebased and removed the custom
xpathandgetCurrentUrlfunctions. Unfortunately there is a new problem in thatAssertBreadcrumbTraitcalls$this->xpathbut can be used in either kernel or functional tests. I've added amethod_existscall in that trait but I think for even better compatibility we should addgetNodeElementsByXpathtoBrowserTestBaseand deprecatexpath.Comment #44
mstrelan commentedI just found #3585774: rename xpath() methods in tests so either we postpone this on that or update that one after this gets in.
Comment #45
smustgrave commentedThis one was postponed once (all be it incorrectly by me) so let’s try and land it.
Comment #48
alexpottCommitted 2129f98 and pushed to main. Thanks!
Committed 3c5fc5f and pushed to 11.x. Thanks!
I recreated the baseline on 11.x in order to merge this there.
Comment #51
alexpottActually the new tests are going to fail on 11.x so reverted.
Comment #53
alexpottBackported to 11.x now that #3583594: Add getUrl() and (renamed) xpath() helpers to HttpKernelUiHelperTrait got backported.