Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
other
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2019 at 19:12 UTC
Updated:
11 Jul 2019 at 20:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
krzysztof domańskiComment #3
johnwebdev commentedNice with test coverage :)
Let's use === instead.
We could use the @covers annotation here.
We can omit this @return.
Comment #5
krzysztof domańskiComment #7
krzysztof domańskiComment #8
krzysztof domańskiComment #9
krzysztof domańskiWe can do the validation with a regural expression.
Comment #10
john cook commentedThis looks really good @Krzysztof Domański.
Adding test coverage where there wasn't any before is alway good.
The regex expression is simple enough so it does not need to be commented.
There isn't a test for this code path.
Adding a test of
[FALSE, 123456](as an integer) toproviderTestValidateHex()would then ensure that this code is covered.Going back to 'needs work' with the 'novice' tag for adding the extra test.
Comment #11
krzysztof domańskiComment #13
john cook commentedThanks for adding the extra test @Krzysztof Domański.
Everything looks good so I'm removing the tags that are no longer required and setting to RTBC.
Comment #15
krzysztof domańskiThe
validateHex()function should return TRUE or FALSE but thepreg_match()function returns 1, 0 or FALSE.Comment #16
john cook commentedGood catch @Krzysztof Domański.
If
assertEquals()is changed toassertSame()we can make sure that the returned value is of correct type as well.Going back to needs work to fix this.
Otherwise it'll be ready for RTBC.
Comment #17
krzysztof domańskiComment #18
john cook commentedThe patch in #17 fixes all the points mentioned here.
The fix for the bug has resulted in shorter code as an understandable regular expression. And good tests covering a range of possible situations has been added to ensure the correct results in the future.
I'm happy for this issue to be RTBC.
Comment #19
larowlanadding issue credits
Comment #22
larowlanCommitted de56b25 and pushed to 8.8.x. Thanks!
c/p to 8.7.x