As a follow-up to #2820490: FormatDate process plugin, we should add testing to validate_format when it is FALSE.

The setting we are talking about handles this:

// Functions that parse date is forgiving, it might create a date that
// is not exactly a match for the provided value, so test for that by
// re-creating the date/time formatted string and comparing it to the input. For
// instance, an input value of '11' using a format of Y (4 digits) gets
// created as '0011' instead of '2011'.
We have coverage for it in core in DateTimePlusTest::testInvalidDates; the setting defaults to TRUE and the test checks for the exception. We don't have coverage when it is FALSE.

But, this setting on DateTimePlus is really one that I really think shouldn't be there, and that code needs to be refactored anyway. I don't see what you would pass in false. I'm half-tempted to say that we should remove the settings. That is the only setting on DTP.

CommentFileSizeAuthor
#3 2865829-03.patch1.45 KBmpdonadio
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heddn created an issue. See original summary.

heddn’s picture

Assigned: Unassigned » mpdonadio
mpdonadio’s picture

Assigned: mpdonadio » Unassigned
Status: Active » Needs review
FileSize
1.45 KB

Ok, here is a test.

Status: Needs review » Needs work

The last submitted patch, 3: 2865829-03.patch, failed testing.

mpdonadio’s picture

Status: Needs work » Needs review

Triggering retest; I thought we fixed the 30sec curl thing: https://www.drupal.org/pift-ci-job/637415

Status: Needs review » Needs work

The last submitted patch, 3: 2865829-03.patch, failed testing.

mpdonadio’s picture

Status: Needs work » Needs review
heddn’s picture

Status: Needs review » Reviewed & tested by the community

This explicitly tests the code under question.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed c2ad4bc to 8.4.x and 038cf10 to 8.3.x. Thanks!

Added to 8.3.x because this is just additional test coverage.

  • alexpott committed c2ad4bc on 8.4.x
    Issue #2865829 by mpdonadio: DateTimePlus test of validate_format =...

  • alexpott committed 038cf10 on 8.3.x
    Issue #2865829 by mpdonadio: DateTimePlus test of validate_format =...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.