Closed (fixed)
Project:
Menu Block
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2019 at 19:06 UTC
Updated:
24 Mar 2020 at 01:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jeroentCurrently the menu_block module does not contain any tests, which makes development very hard.
Comment #3
jeroentTests will currently fail because of the bug in: #3022011: Implement config schema for block.settings.menu_block.*.{follow, follow_parent}
Comment #4
jeroentComment #5
jeroentCleanup + added test for theme suggestions.
Comment #6
idebr commentedClosed #3022012: Add automated tests as a duplicate issue.
Comment #7
jeroentGood catch @idebr, completely missed that issue.
Comment #8
idebr commentedTests are green now that #3022011: Implement config schema for block.settings.menu_block.*.{follow, follow_parent} is committed.
Comment #9
dwwShould probably commit #3086171: Add @file doc block to menu_block.module first so that the testbot stops marking patches as failed...
Thanks,
-Derek
Comment #10
dwwNah, I guess not. ;) https://www.drupal.org/pift-ci-job/1427031 suggests that all patches uploaded to this queue will fail until this patch is committed, since the bot can't find any tests to run. So yeah, let's get this in ASAP. Bumping to major since the current project configuration is causing a bunch of issue churn in here, confusing contributors, etc.
However, looking closely at the patch, I have some concerns, and I think a re-roll is in order before this is truly RTBC...
A) Seems like the intention of the code comment is that child-1-2 has child-1-1 as the parent, but that doesn't match the code itself.
B) The link itself seems like it should match the menu structure, so we don't confuse ourselves. E.g. child-1-2's link should be
/menu-test/hierarchy/parent/child-1/child-1-2Seems the link should be to .../parent/child-1 to be more self-documenting.
Maybe it doesn't matter, but it's not at all clear why the link for this is /hierarchy/parent/child2/child since it seems (based on the comments) that the link should be /hierarchy/parent/child-1/child-1-1
This link seems like it wants to be .../hierachy/parent/child2 (or .../child-2)
core seems to use
$this->assert*everywhere. Not clear why we're usingself::here.Yoda used is not by core much, either. ;)
This makes me slightly nervous, based on my concerns above. But since the tests are only ever asserting the text of the menu items, not where they point, it all seems to be working fine.
But this is further evidence that child-1-1 and child-1-2 are both supposed to be immediate children of child-1, so the code comment should be properly indented, and all the paths should match that to make all this more robust...
Thanks! Having this in the code will definitely help further development.
Cheers,
-Derek
Comment #11
jeroent1. Fixed. You're right, the comment was not indented correctly.
2. Fixed.
3. Fixed.
4. Fixed.
5. I used self:: because the assert methods are declared statically. According to the PHPUnit docs there is no right or wrong way (https://phpunit.de/manual/6.5/en/appendixes.assertions.html#appendixes.a...) so I will match Drupal Core :-).
Comment #13
jeroentComment #14
jeroentAh, I remember why I did the naming of the URLs like that. Because I was depending on the menu_test module.
Created a separate menu_block_test module to make the naming of the URLs more clear.
Comment #15
jeroentComment #16
dwwFantastic, thanks! Almost there. :)
This is only for core. Contrib modules should never do this.
For consistency, these should all be the same case. Probably lowercase for everything.
None of these are needed.
Oh look, the bot agrees:
https://www.drupal.org/pift-ci-job/1427675
;)
Core standards say comments like this should start with a verb. E.g. "Returns placeholder page content which can be used for testing." or something...
ubernit:
s/Create/Creates/
Ahhh, so much better! Comments, paths, and link names all make sense now.
Thanks!! :)
More ubernits:
s/Check/Checks/
s/Test/Tests/
Of these, only #1 and #3 need to be fixed. Everything else is just hyper nitpicking for consistency with core's (sometimes ridiculous) standards.
So as not to be too much of a pain in the ass, I'll just upload a fixed patch in a moment. ;) Stay tuned.
Thanks!
-Derek
Comment #17
dwwThis should be RTBC. Everything passes locally.
Comment #18
dwwp.s. Note to committers: d.o now thinks I should be the author of this commit. :( Please no. @JeroenT should be the author. Thanks!
Comment #19
dinesh18 commented#17 looks good to me. +1 to RTBC
Comment #20
dwwOkay, RTBC it is. :)
Thanks,
-Derek
Comment #21
chris matthews commentedComment #23
joelpittetThanks @JeroenT and @dww, I've committed this to the dev branch
Comment #24
dwwYay, thanks!