Make WordPress Core


Ignore:
Timestamp:
09/19/2022 09:18:59 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace the timezone used in date/time tests.

The Europe/Kiev timezone has been deprecated in PHP 8.2 and replaced with Europe/Kyiv.

The tests updated in this commit are testing the WordPress date/time functionality. They are not testing whether WP or PHP can handle deprecated timezone names correctly.

To ensure the tests follow the original purpose, the use of Europe/Kiev within these tests is now replaced with the Europe/Helsinki timezone, which is within the same timezone as Europe/Kyiv. This should ensure that these tests run without issue and test what they are supposed to be testing on every supported PHP version (unless at some point in the future Europe/Helsinki would be renamed, but that's a bridge to cross if and when).

Note: Separate tests should/will be added to ensure that relevant date/time related functions handle a deprecated timezone correctly, but that is not something these tests are supposed to be testing.

Follow-up to [45853], [45856], [45876], [45882], [45887], [45908], [45914], [46577], [46154], [46580], [46864], [46974], [54207].

Props jrf, costdev.
See #56468.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/date/mysql2date.php

    r54207 r54217  
    3737     */
    3838    public function test_mysql2date_should_format_time() {
    39         $timezone = 'Europe/Kiev';
     39        $timezone = 'Europe/Helsinki';
    4040        update_option( 'timezone_string', $timezone );
    4141        $datetime = new DateTime( 'now', new DateTimeZone( $timezone ) );
     
    5151     */
    5252    public function test_mysql2date_should_format_time_with_changed_time_zone() {
    53         $timezone = 'Europe/Kiev';
     53        $timezone = 'Europe/Helsinki';
    5454        // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
    5555        date_default_timezone_set( $timezone );
     
    6767     */
    6868    public function test_mysql2date_should_return_wp_timestamp() {
    69         $timezone = 'Europe/Kiev';
     69        $timezone = 'Europe/Helsinki';
    7070        update_option( 'timezone_string', $timezone );
    7171        $datetime     = new DateTime( 'now', new DateTimeZone( $timezone ) );
     
    8181     */
    8282    public function test_mysql2date_should_return_unix_timestamp_for_gmt_time() {
    83         $timezone = 'Europe/Kiev';
     83        $timezone = 'Europe/Helsinki';
    8484        update_option( 'timezone_string', $timezone );
    8585        $datetime  = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
Note: See TracChangeset for help on using the changeset viewer.