Closed (fixed)
Project:
Drupal core
Version:
10.3.x-dev
Component:
contact.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2015 at 14:33 UTC
Updated:
23 Jul 2026 at 18:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tstoecklerHere we go.
Comment #2
larowlanComment #3
xjmIf there is a bug exposed by this, we should presumably have tests? Thanks!
Comment #4
andypostand yep that needs tests
probably Element:children($data[tabs])
Comment #5
alimac commentedI would like to add a test, but I am not sure what to test for. Can someone point me in the right direction?
Comment #6
alimac commentedI found this test in contact/src/Tests/ContactPersonalTest.php:
I think the test would have to unset the tabs, then visit the user contact page and make sure it loads OK (200).
Comment #7
yesct commentedso, when @andypost mentions Element:children($data[tabs])
maybe that is a hint that this doesn't have to be a simpletest with a drupalsite, and can be a phpunit test on the output of the method?
Comment #8
dawehnerIf you look at
menu_local_tasks()there is the chance that$data['tabs'][0]is empty indeed.I mean it is really hard to trigger because
/user/{user}is either accessible, so is the tab, or we result in a 403,in which case $route_name is 'system.403', so I doubt you can ever run into that case in real life.
Do you mind pasting an URL to that? Why do we even try to produce local tasks on the maintenance page.
Comment #9
tstoecklerI'm able to reproduce this, if I enable maintenance mode and then hit
/user/1as an anonymous user.Not sure whether we should test that specifically, though, because that is quite specific to the "tabs on maintenance page" problem.
The problem is that
template_preprocess_page()checks for theMAINTENANCE_MODEconstant before fetching local tasks and tabs, but that is only defined ininstall.phpandauthorize.php, not during the normal maintenance mode.@dawehner do you have thoughts on this?
Comment #10
tatisilva commentedWrote phpunit test which tests for the undefined index. This is the opposite of what we actually want the test to do but could not figure how to test for a missing undefined index notice.
Comment #17
andypost@tatisilva this test should be in .patch format
Comment #18
andypostComment #20
akashkumar07 commentedI have changed the format from .txt to .patch. Hope, this will solve the issue.
Comment #21
andypostLooks good start!
I bet you need to add contact module to the list of installed ones
Comment #22
akashkumar07 commentedComment #24
akashkumar07 commentedHope, this patch would fix the issue.
Comment #25
akashkumar07 commentedComment #27
rithesh bk commentedcurrently i am working on it ....
Comment #28
rithesh bk commentedPlease review it..... i have updated the patch .....
Comment #30
rithesh bk commentedPlease find the updated patch ..
Comment #32
rpayanmComment #34
rpayanmComment #37
larowlanWe've now got a test only file, but no fix.
And the test-only file doesn't fail.
Can someone confirm if this issue still exists?
Comment #40
sudiptadas19 commentedAdd isset checking for tabs and corresponding test cases in MR 346. Please review the changes.
Comment #41
larowlanI think we're probably better to remove that test and try to test it using the maintenance page approach per the issue summary steps to reproduce
Comment #42
larowlanYeap, the test failed now because it is expecting the broken behaviour and we've fixed it, but it needs to be the other way around
Comment #43
sudiptadas19 commentedTest file removed. Updated changes available in MR346. Please review.
Comment #47
smustgrave commentedSeems to be a simple isset() check. I see the test file was added and then removed so not sure if a new one is needed?
Also may need a reroll for 9.5.x. The MR is aimed at 9.2.x
But following the testing steps
Make sure contact module is installed
Turn maintenance mode on
Went to /user/1 because the code checks $route_name == 'entity.user.canonical'
Not sure how to trigger local tasks but there are no local tasks.
Would say this needs an issue summary update (so move to PNMI)
Or maybe closed as can't reproduce.
Comment #48
andypostBtw #34 ist the best test to reproduce (
Comment #49
smustgrave commentedUpdated the patch #34. Uploading a tests only patch.
Comment #52
larowlanThis is the wrong namespace, I think we just want to use \Exception in the code (ie with the \), however read on below, I think we don't need either.
I don't think this is supported/required with a UnitTestCase, so we can remove it
I don't think we need a local variable for the route name, lets just pass it straight to the function
PHPUnit will fail if there's an unhandled exception, so we don't need the try catch
Instead of this, I think we test the valid use-case (ie when $data['tabs'][0] is set), so then we have a positive assertion that expands coverage of that method rather than testing for just the exception case - thoughts?
Comment #53
pradhumanjain2311 commentedTry to Addressed Comment #52
Still need to work on Point 5.
Comment #54
smustgrave commentedSo contact_menu_local_tasks_alter doesn't return anything so how would be best to test?
Comment #55
larowlanI assume it alters by reference (on phone didn't check)
Comment #57
quietone commentedThe next task here is to convert the latest patch to an MR, that is suitable for a first issue.
Comment #61
mrinalini9 commentedFixed pipeline issues, please review it.
Thanks!
Comment #63
smustgrave commentedTweaked the test slightly but test-only shows the test coverage and code fix is straight forward.
Comment #64
quietone commentedI read the issue, comments and the MR etc. I found all questions answered and all core gates have been addressed. I think this is good to go.
I have updated credit.
Assigning to myself to commit within 24 hours.
Comment #69
quietone commentedThanks!
Committed to 11.x, 11.0.x, 10.4.x, and 10.3.x.
Comment #71
quietone commented