Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
text.module
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Jun 2016 at 11:23 UTC
Updated:
23 Jul 2021 at 08:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
JvE commentedThe change of
filter_fallback_format()is to decouple from a hard dependency on the filter module and improve testability.Comment #3
JvE commentedComment #13
kristen polThanks for the issue and patch. I found a few minor things.
Isn't this out of scope for this issue?
Nitpick: change "
configfactory" to "config factory".Switch from
array()to[]syntax.Since there is only one config, it could be passed in directly like many tests do, e.g.
Other tests use
$config_factory.I don't see
Unicode::strlenused anywhere in core code.Comment #14
ankithashettyRerolled the patch in #1. Also addressed all the points from #13 13.1, 13.2, 13.3, 13.4, 13.5, 13.6.
Thank you!
Comment #15
pavnish commented@Kristen Pol Rerolled the patch for drupal 9.2.x.
#13 Has been addressed with some additional changes use getMockBuilder function
Comment #16
pavnish commentedIgnore #15 @Kristen Pol Rerolled the patch for drupal 9.2.x.
#13 Has been addressed with some additional changes use getMockBuilder function
Comment #17
pavnish commentedThere were some linting issues in #16 Please Ignore #16. I have fixed linting issues and Rerolled the patch for drupal 9.2.x.
#13 Has been addressed with some additional changes use getMockBuilder function
Comment #18
pavnish commentedComment #19
pavnish commentedComment #21
kristen pol@pavnish I don't understand why you created your own new patch rather than starting with #14.
Comment #22
suresh prabhu parkala commentedTried to remove the errors from #14 patch. Please review.
Comment #24
nikitagupta commentedfixed the test case form #22.
Comment #26
vakulrai commentedUpdated the Tests and Made some changes to
generateSampleValue()method.Comment #27
vakulrai commentedMissed the Patch from previous commits , adding that.
Comment #28
gauravvvv commentedI have provided a patch, please verify if it is working or not.
Comment #29
vakulrai commentedUpdated coding standards in the tests.
Comment #30
vakulrai commentedComment #31
vakulrai commentedComment #33
kristen polHard to follow all the patches but I looked at the last one.
In #2, it says:
but that is out of scope of this issue so would need to be separated out.
Comment #34
neslee canil pinto@Kristen pol, so you are telling us we need to remove #2 from this issue and create a new one for that?
Comment #35
neslee canil pintoAs per #33's 2nd point, this patch removes the code which was requested to be added in #2
Comment #37
neslee canil pintoComment #39
meenakshi_j commentedComment #40
quietone commented@Meenakshi_j. Welcome to Drupal. Thanks for adding an interdiff. When adding a patch it helps the next person working on the issue (whether reviewer or developer) if you add a comment explaining why you made the changes you made.
? No, we can just remove the filter.
Unit tests do not have a database. Therefor this does nothing.
This should test more than a length of 1.
I started to review and then I realized that this needs will need a Kernel test so that the function, filter_fallback_format, is available. As pointed out in #33 changing that is out of scope.
Then, even thought it is late I decided to make a patch myself.
Comment #41
quietone commentedIt may look like there is work to do in #30 but there isn't. I abandoned the review and wrote a new patch.
The patch in #40 is ready for review.
Comment #42
larowlanThanks @quietone - can we get a test-only patch?
Thanks
Comment #43
quietone commentedOops, you are right, I forgot.
Here it is.
Comment #45
larowlanLooks great, thanks
Comment #46
catchWe don't normally use the fail condition for custom phpunit assertion messages, I think we'd be better of without this.
Comment #47
larowlanWithout it we just get the line number, which is in the loop, so we don't know what failed
Tentatively putting back to rtbc
Comment #48
larowlanActually no we don't we get the size
Comment #49
acbramley commentedMy 2c - make it a dataProvider instead of an array with a loop for more context :)
Comment #50
quietone commentedI must not be understanding the problem here.
Sorry, size of what?
That is from #3131946: [policy] Remove PHPUnit assertion messages when possible, and standardize remaining messages . And I do not think that this needs to a new test environment for each source value.
Finally, lets see what happens with a failure.
When using a string length that fails, such as 0, the error message is
That tells me exactly which of the input $string_lengths is causing the problem.
Setting to NR.
Comment #51
paulocsI think @larowlan is pointing that when the test only patch is applied, the error message is not the error of the PHPUnit. It is the PHP error of the currently bug. For me is okay to let it as it is because the assertion is in a
foreachand if the$this->assertEqualsfails, it will be displayed a good help message.See:
I agree that no data provider is required as it will need a new test environment for each source value so #49 is not necessary.
Just one thing:
Do we need to explain why we are specifically testing 1, 2, and 3? Maybe adding a @see tag to the comment.
Comment #52
larowlanJust to be clear, I was agreeing with catch, the output will say 'failed asserting that 3414 matches expected 0' where 0 is the length, so you can discern which case failed.
But I do agree with Adam, that this would make sense as a data provider, however we're paying a setup cost for the kernel test each time, so the added test execution time might be a factor there
And I agree with Paulo, some context of why those lengths are significant would be great too
Comment #53
quietone commented@paulocs, thanks for the explanation.
I didn't find anything in the issue that added TestItemBase to explain why the max_length is divided by three. #2320157: Generate placeholder content for Field types.
This patch adds a dataprovider and a comment in the test to explain the values chosen.
Comment #54
quietone commentedOh bother, I did fix that but neglected to make a new patch.
Comment #55
paulocsLooks good.
Patch is working as expected and it addresses #52.
Comment #56
alexpottCommitted 12aec14 and pushed to 9.3.x. Thanks!
I'll backport to 8.2.x once the freeze is over.
Comment #59
alexpottCherry-picked to 9.2.x