Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

#63079 closed defect (bug) (fixed)

Phpunit test failure due to US daylight saving time

Reported by: audrasjb's profile audrasjb Owned by: johnbillion's profile johnbillion
Milestone: 6.8 Priority: normal
Severity: normal Version: trunk
Component: Date/Time Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

The test_wp_timezone_override_offset phpunit test is currently failing due to US daylight saving time.

Change History (11)

#1 @audrasjb
6 weeks ago

  • Component changed from General to Build/Test Tools

#2 @audrasjb
6 weeks ago

Test failure:

Tests_Functions_wpTimezoneOverrideOffset::test_wp_timezone_override_offset with data set "NST option set" ('America/St_Johns', -3.5)
Failed asserting that -2.5 is identical to -3.5.

#3 @audrasjb
6 weeks ago

Related: #59980

Introduced in [59931].

This ticket was mentioned in PR #8479 on WordPress/wordpress-develop by @debarghyabanerjee.


6 weeks ago
#4

  • Keywords has-patch has-unit-tests added; needs-patch removed

Trac Ticke: Core-63079

### Summary

  • This PR fixes the failing test for wp_timezone_override_offset(), caused by Daylight Saving Time (DST) adjustments in America/St_Johns. The test previously expected a static -3.5 offset, but during DST, the actual offset is -2.5, leading to failures.

### Changes

  • Introduced get_expected_offset() to dynamically determine the correct offset.
  • Updated the test data provider to use this function instead of a hardcoded value.

@audrasjb commented on PR #8479:


6 weeks ago
#5

I think a better approach would be something along the lines of: if the America/St_Johns timezone is currently observing DST then the expected value is -2.5, else the expected value is -3.5. What do you think?

Yes, nice idea, sounds good to me 👍

@debarghyabanerjee commented on PR #8479:


6 weeks ago
#6

Hi @johnbillion , It makes sense, thanks for the review and feedback. I have updated the implementation, can you please check once. Assigning your for re-review.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


6 weeks ago

#8 @johnbillion
6 weeks ago

  • Component changed from Build/Test Tools to Date/Time
  • Keywords commit added

#9 @johnbillion
6 weeks ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 59959:

Date/Time: Fix the recently introduced test for wp_timezone_override_offset() which failed to take into consideration daylight saving time for the America/St_Johns timezone.

Props debarghyabanerjee, johnbillion, mukesh27, audrasjb.

Fixes #63079

@johnbillion commented on PR #8479:


6 weeks ago
#10

This was committed in https://core.trac.wordpress.org/changeset/59959 . Thanks everyone!

@johnbillion commented on PR #8479:


6 weeks ago
#11

This was committed in https://core.trac.wordpress.org/changeset/59959 . Thanks everyone!

Note: See TracTickets for help on using tickets.