Problem/Motivation
// The description for an update comes from its Doxygen.
$func = new ReflectionFunction($module . '_update_' . $update);
$description = str_replace(array("\n", '*', '/'), '', $func->getDocComment());
My reading of this is that if the docblock text contains a slash that'll get zapped. So anything like 'either/or' or 'and/or' will be garbled.
Also, if the docblock has more than one line, we'll get too much whitespace in between the lines, as only the '*' is removed and there'll be at least one space either side of it.
Steps to reproduce
See #1.
Proposed resolution
Use regular expressions to modify the comment instead of a simple str_replace.
Remaining tasks
Review
Commit
User interface changes
Displayed update hook text can contain slashes and less extra spaces.
Comment | File | Size | Author |
---|---|---|---|
#18 | 1624278-18.patch | 6.49 KB | quietone |
#18 | interdiff-14-18.txt | 4.15 KB | quietone |
#14 | 1624278-14.patch | 6.59 KB | quietone |
#14 | interdiff-10-12.txt | 1.63 KB | quietone |
#10 | 1624278-10.patch | 4.59 KB | quietone |
Comments
Comment #1
joachim CreditAttribution: joachim commentedQuick command line script to demonstrate:
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedA possible solution.
Comment #11
quietone CreditAttribution: quietone as a volunteer commentedComment #14
quietone CreditAttribution: quietone as a volunteer commentedFixing the failing tests, just needed to remove a space from the string to test.
Comment #15
quietone CreditAttribution: quietone as a volunteer commentedReady for review
Comment #16
longwaveThis is quite longwinded, we could just say:
Why do we still have two spaces after the dash? Is it out of scope to tidy this up completely so it is just "8001 - Description"?
Comment #17
longwaveUsually we don't extract this to a variable and just call assertSession() each time.
Comment #18
quietone CreditAttribution: quietone as a volunteer commented#16 1,2 Changed format and modified to remove the extra space.
#17 - Ah, that is how it is done in the migrate_drupal_ui tests so just force of habit. Fixed.
Comment #19
longwaveThanks, this looks great now!
Comment #21
SpokjePlease do not ask the testbot to try again until #3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest is fixed.
Comment #22
Spokje#3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest was committed. Ordered retest and put this issue back to RTBC per #19.
Comment #25
larowlanSuch a shame we need a BrowserTest to test this.
Can we get a follow up task to make
update_get_update_list()
unit testable?Committed fe06cae and pushed to 9.2.x. Thanks!
Backported this to 9.1.x because the risk of disruption is low.
Comment #26
quietone CreditAttribution: quietone as a volunteer commentedFollowup created, #3210502: Convert UpdateDescriptionTest to a kernel test
Comment #28
quietone CreditAttribution: quietone at PreviousNext commentedLooks like I forgot to remove a tag.