Skip to content

test: resolve issues with tests and crossing a DST boundary#1110

Merged
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/test_dst
Mar 7, 2026
Merged

test: resolve issues with tests and crossing a DST boundary#1110
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/test_dst

Conversation

@JohnVillalovos
Copy link
Copy Markdown
Collaborator

Tests were failing as the range they were using was crossing a Daylight Savings Time (DST) boundary. Switch those tests to use a fixed date/time.

Tests were failing as the range they were using was crossing a Daylight
Savings Time (DST) boundary. Switch those tests to use a fixed
date/time.
Copilot AI review requested due to automatic review settings March 7, 2026 16:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates a few reservation-related tests to avoid flakiness caused by date math crossing a DST boundary by freezing the global Date::Now() value to a fixed midday timestamp.

Changes:

  • Freeze Date::Now() to a fixed timestamp in testBindsToClosestPeriod().
  • Freeze Date::Now() to a fixed timestamp in testBindsToClosestPeriodFromReservationDates().
  • Freeze Date::Now() to a fixed timestamp in testMaxNoticeIsCheckedAgainstEachReservationInstanceForEachResource().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/Presenters/Reservation/ReservationInitializationTest.php Freezes Date::Now() for the “closest period” binding test to avoid DST-boundary flakiness.
tests/Presenters/Reservation/ExistingReservationInitializerTest.php Freezes Date::Now() for the “closest period from reservation dates” test to avoid DST-boundary flakiness.
tests/Application/Reservation/ResourceMaximumNoticeRuleTest.php Freezes Date::Now() for the max-notice validation test to keep repeat-instance date generation deterministic.

You can also share your feedback on Copilot code review. Take the survey.

@JohnVillalovos JohnVillalovos merged commit 539acc3 into develop Mar 7, 2026
19 checks passed
@JohnVillalovos JohnVillalovos deleted the jlvillal/test_dst branch March 7, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants