Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The tool menu link added by the tracker module is missing test coverage.
Proposed resolution
Add tests for tool menu link added by tracker module
Remaining tasks
Commit it.
User interface changes
None
API changes
None
Data model changes
None.
Original Report
According to the documentation of the tracker module, after it is enabled there should be a new link in the Tools menu and a tab on a user's profile page. This functionality appears to be broken in the current branch. See tracker_help() and the doc page.
Comment | File | Size | Author |
---|---|---|---|
#26 | 2120877-26.patch | 1.36 KB | quietone |
Comments
Comment #1
BryanGullan CreditAttribution: BryanGullan commentedJust so others know, I'm currently working on a patch for this.
Comment #2
BryanGullan CreditAttribution: BryanGullan commentedI've attached a patch for this. Question: should there be any tests created to confirm that the menu items are present? I don't think that other menu items in that menu have tests, but I could be mistaken.
Comment #3
dags CreditAttribution: dags commentedMinor whitespace fix:
Patch adds the 'Tracker' tab to the user profile page, but I don't see anything in the Tools menu. Actually, I can't even load the Tools menu page (/admin/structure/menu/manage/tools). I think my local dev env. might is busted or misconfigured somehow... I'm getting this on every menu mange page:
Comment #4
BryanGullan CreditAttribution: BryanGullan commentedHey,
It does sound like your build is playing up. Works fine for me on the fresh install on which I created the patch. The Tools menu item is labelled "Recent content", in line with the description in the existing help text within the tracker module.
Re. the whitespace fix: as part of the tracker_cron() function, that's unrelated to this bug and the patch: the patch does not change that particular line within the module file. To be pedantic, my opinion would be that the whitespace there should be fixed in its own issue (I've not looked, but maybe there is already an issue for that?) :-)
Bryan
Comment #4.0
BryanGullan CreditAttribution: BryanGullan commentedUpdated issue summary.
Comment #5
miro_dietikermakemineatriple, the whitespace reference by dags was wrong.
Your patch added a whitespace in hook_menu() though.
Comment #6
pwolanin CreditAttribution: pwolanin commentedpatch is outdated
Comment #7
duellj CreditAttribution: duellj commentedRerolled patch to remove whitespace.
Comment #8
miro_dietikerThis functionality was missing after port, because there's no test coverage.
A fix should add test coverage as well.
Comment #9
dawehnerWe also have to move to .menu_links.yml files.
Comment #10
joshi.rohit100I can see the Track link in user profile. So, Is this need to be done or just test case waiting ?
Comment #11
miro_dietikerjoshi.rohit100 you could check if there is a test by ... for instance file a patch that removes the Track link and see if it fails with the testbots on d.o.
Comment #20
quietone CreditAttribution: quietone as a volunteer commentedThank you for reporting this issue and posting a patch.
As part of the Bug Smash Initiative, we are triaging issues that are marked "Needs tests". This issue was marked "Needs tests" back in June 2014. The issue itself is fixed, joshi.rohit100 pointed that out in July 2014. Also in July 2014, miro_dietiker recommended adding tests because the "This functionality was missing after port".
If I get this, this needs a test to confirm that 'recent content' link exists in the tools menu and that the 'Activity' tab appears on the users profile page. Looking at the existing functional tests,TrackerTest and TrackerNodeAccessTest, there are usages of
$this->drupalGet('activity');
and assertions on the text of the resulting page. Is that sufficient tests for the activity tab? I didn't see any tests using the 'recent content' link, so that will still need a test.Comment #21
jibranThe bug seems to be fixed.
In
core/modules/tracker/tracker.routing.yml
We now have
And we do have tests for this in
\Drupal\Tests\tracker\Functional\TrackerTest::testTrackerUser()
We have
core/modules/tracker/tracker.links.menu.yml
We don't have dedicated test for this.
we have
\Drupal\Tests\tracker\Functional\TrackerTest::testTrackerHistoryMetadata()
for that.Comment #22
quietone CreditAttribution: quietone as a volunteer commented@jibran, thanks for your help here and in #bugsmash. Without that his help this patch would not be here.
Comment #23
jibranYay! patch looks great. Here are some suggestions:
This can be removed.
Let's assert no link before adding this block.
[]
not required.Comment #24
quietone CreditAttribution: quietone as a volunteer commentedYay, indeed!
1. Ah, silly me. Too focused on having a test outside of migrate actually work that I didn't notice this.
2. Good idea. Added.
3. Didn't know that. Fixed.
I renamde the test file which made an interdiff not helpful at all, so I made a diff instead.
Comment #25
jibranThis seems ready just a nit.
We can move this line two lines above because we are trying to assert that frontpage has no link before we place the block.
Comment #26
quietone CreditAttribution: quietone as a volunteer commentedOh, that makes sense.
Comment #27
jibranThanks, looks good now. Updated the title and IS.
Comment #28
alexpottCommitted and pushed 1ea2763329 to 9.1.x and a832400398 to 9.0.x and d63ddf191e to 8.9.x. Thanks!
I ran the test on 9.1.x before committing - it was green.