Problem/Motivation
In #3032084: Add an option for menu depth we introduced a menu_depth option for sitemap menu plugins, but forgot to set a default for the option.
In Drupal CMS's PHPUnit test, the latest release of sitemap has broken us due to an undefined array key (which will fail PHPUnit tests):
Exception: Warning: Undefined array key "menu_depth"
Drupal\sitemap\Plugin\Sitemap\Menu->view()() (Line: 116)
Proposed resolution
This seems like a minor oversight; probably what's needed is to ensure that menu_depth has a default value in the class's #[Sitemap] attribute.
Remaining tasks
Write a patch- done by @phenaproxima in #2Review and feedback- done by @mparker17 in #5RTBC and feedback- done by @mparker17 in #5Commit- done by @mparker17 in #7Release- released in 8.x-2.2
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork sitemap-3541905
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
Comment #3
phenaproximaComment #4
mparker17For the purposes of documentation, the
menu_depthoption was introduced in #3032084: Add an option for menu depth, which includedsitemap_update_8205()to update existing configuration.Instructions for running
sitemap_update_8205()were mentioned in the Upgrade instructions section of the 8.x-2.1 release notes (I took time writing that section, because there's been some confusion after previous releases about how to upgrade the module — see #3466939: Route "sitemap.page" does not exist error after upgrading to 8.x-2.0-beta7)As a module maintainer, I'm curious to know what I could do to avoid this in the future. That is to say, what is Drupal CMS testing that I'm not testing? How could I improve test coverage to avoid this?
Comment #5
mparker17Reviewing the code, it looks good to me.
Comment #6
mparker17Assigning attribution.
Comment #8
mparker17@phenaproxima, it has been merged!
Can I assume you'd like me to make a bugfix release right away?
Comment #9
mparker17Updating status and issue summary so it's easy to figure out what happened in the future.
Comment #10
phenaproxima@mparker17, thanks for merging this! An immediate bugfix release is not necessary unless you really want to; this is currently only affecting Drupal CMS's tests -- I doubt it poses any problem for live sites. Therefore we have no problem patching it for internal development purposes.
Comment #11
mparker17I released sitemap-8.x-2.2 today with this fix. Thanks @phenaproxima!
Please do let me know if there's anything that I can do to improve my test coverage so I don't break Drupal CMS tests in the future!