Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In core/modules/views/src/Tests/Handler/FieldDateTest.php there is a note with a @todo that says we need to add tests for the raw time span and time span. This issue is to track that it gets done.
Beta phase evaluation
Issue category | Task - adding a new test that was missing |
---|---|
Issue priority | Adding new tests is just a Normal thing, not Major/Critical, who knows how long it's been missing. |
Unfrozen changes | Unfrozen because it only adds tests and documentation. |
Comment | File | Size | Author |
---|---|---|---|
#15 | fieldDateTest-future_formatters-2488844-15.patch | 6.03 KB | markie |
#13 | fieldDateTest-future_formatters-2488844-13.patch | 5.19 KB | markie |
#12 | fieldDateTest-future_formatters-2488844-12.patch | 4.26 KB | markie |
Comments
Comment #1
markie CreditAttribution: markie at Mediacurrent commentedJust want to verify, do we want to write tests for all the default views date formatters? I have this as a list:
Comment #2
jhodgdonIf all of those methods are lacking tests, then yes it would be good to add tests for all of them. Thanks!
Comment #3
markie CreditAttribution: markie at Mediacurrent commentedComment #4
markie CreditAttribution: markie at Mediacurrent commentedHere is my first pass at the "time hence" (future comparisons) tests. I had to add a new field to the view that has a future date and set it to 2050. I assume we'll be done by then.
Comment #6
markie CreditAttribution: markie at Mediacurrent commentedSo my fixed killed other tests. I forget if that's called progress or not.
Comment #7
markie CreditAttribution: markie at Mediacurrent commentedSo my fixed killed other tests. I forget if that's called progress or not.
Comment #8
jhodgdonI think maybe some of those failures were random test bot glitches, so retesting.
Comment #9
jhodgdonOh, well maybe not, it looks like the array that you added to was being used in another test, so best to do make your own test data for this test. Shouldn't be too hard to update?
Comment #12
markie CreditAttribution: markie at Mediacurrent commentedIt makes more sense to do it all in one test instead of manipulating the main. That's the beauty of extending a class right?
Comment #13
markie CreditAttribution: markie at Mediacurrent commentedAdding other time formats as listed in #1. Full array of tests should be complete now.
Comment #14
jhodgdonThanks! Looks good, and the test passes. The only problem I saw was one typo:
Typo: destryoyed => destroyed
Also, any method you add to a class should have a doc block, even in a test. I see that the others in that test class don't have doc blocks, but our Documentation Gate requires that any added code be added with documentation. So please add doc blocks to your added methods. If you want to go back and document the rest of the class, that would be a bonus; if not we can file a follow-up issue.
Doc block standards are at:
https://www.drupal.org/node/1354
Comment #15
markie CreditAttribution: markie at Mediacurrent commentedUpdated docblocks and fixed typo.
Comment #16
jhodgdonThanks!! Excellent! I could suggest a few minor wording changes in the docs, but since this is all tests and it's all clear, I think the docs are good enough -- and having doc blocks at all is a Big Plus.
Adding beta eval to issue summary.
Comment #17
jhodgdonNote: #2456521: Add DateFormatter::formatDiff() as a non-buggy alternative to DateFormatter::formatInterval() when the start and end of the interval are known patch will conflict with this, so we'll see which gets committed first (I'm marking this issue as related from there, since that is where this one came from).
Comment #18
alexpottCommitted 9150446 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation.