diff --git a/tests/phpunit/tests/date/currentTime.php b/tests/phpunit/tests/date/currentTime.php index c98292ef0d..72d50abfba 100644 --- a/tests/phpunit/tests/date/currentTime.php +++ b/tests/phpunit/tests/date/currentTime.php @@ -7,6 +7,17 @@ */ class Tests_Date_CurrentTime extends WP_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset changed options to their default value. + update_option( 'gmt_offset', 0 ); + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * @ticket 34378 */ diff --git a/tests/phpunit/tests/date/dateI18n.php b/tests/phpunit/tests/date/dateI18n.php index 9279aca4eb..5bd340b91d 100644 --- a/tests/phpunit/tests/date/dateI18n.php +++ b/tests/phpunit/tests/date/dateI18n.php @@ -7,6 +7,17 @@ */ class Tests_Date_DateI18n extends WP_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset changed options to their default value. + update_option( 'gmt_offset', 0 ); + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * @ticket 28636 */ diff --git a/tests/phpunit/tests/date/getFeedBuildDate.php b/tests/phpunit/tests/date/getFeedBuildDate.php index c1d9edb66c..5f0416ce53 100644 --- a/tests/phpunit/tests/date/getFeedBuildDate.php +++ b/tests/phpunit/tests/date/getFeedBuildDate.php @@ -11,7 +11,7 @@ class Tests_Date_GetFeedBuildDate extends WP_UnitTestCase { public function tear_down() { global $wp_query; - update_option( 'timezone_string', 'UTC' ); + update_option( 'timezone_string', '' ); unset( $wp_query ); diff --git a/tests/phpunit/tests/date/getPermalink.php b/tests/phpunit/tests/date/getPermalink.php index 41977c7734..195717dbd8 100644 --- a/tests/phpunit/tests/date/getPermalink.php +++ b/tests/phpunit/tests/date/getPermalink.php @@ -10,7 +10,7 @@ class Tests_Date_GetPermalink extends WP_UnitTestCase { public function tear_down() { delete_option( 'permalink_structure' ); - update_option( 'timezone_string', 'UTC' ); + update_option( 'timezone_string', '' ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set date_default_timezone_set( 'UTC' ); diff --git a/tests/phpunit/tests/date/getPostTime.php b/tests/phpunit/tests/date/getPostTime.php index ad9eb0cf31..21b9c8675b 100644 --- a/tests/phpunit/tests/date/getPostTime.php +++ b/tests/phpunit/tests/date/getPostTime.php @@ -9,6 +9,16 @@ */ class Tests_Date_GetPostTime extends WP_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset the timezone option to the default value. + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * @ticket 28310 */ diff --git a/tests/phpunit/tests/date/mysql2date.php b/tests/phpunit/tests/date/mysql2date.php index 7c83446b00..b53a57cfac 100644 --- a/tests/phpunit/tests/date/mysql2date.php +++ b/tests/phpunit/tests/date/mysql2date.php @@ -11,6 +11,9 @@ class Tests_Date_mysql2date extends WP_UnitTestCase { // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set date_default_timezone_set( 'UTC' ); + // Reset the timezone option to the default value. + update_option( 'timezone_string', '' ); + parent::tear_down(); } diff --git a/tests/phpunit/tests/date/query.php b/tests/phpunit/tests/date/query.php index e3f4ba0f6f..7e3cd73392 100644 --- a/tests/phpunit/tests/date/query.php +++ b/tests/phpunit/tests/date/query.php @@ -21,6 +21,16 @@ class Tests_Date_Query extends WP_UnitTestCase { $this->q = new WP_Date_Query( array( 'm' => 2 ) ); } + /** + * Cleans up. + */ + public function tear_down() { + // Reset the timezone option to the default value. + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + public function test_construct_date_query_empty() { $q = new WP_Date_Query( array() ); $this->assertSame( 'AND', $q->relation ); diff --git a/tests/phpunit/tests/date/wpTimezone.php b/tests/phpunit/tests/date/wpTimezone.php index 8b1f09e4d1..3b60462163 100644 --- a/tests/phpunit/tests/date/wpTimezone.php +++ b/tests/phpunit/tests/date/wpTimezone.php @@ -8,6 +8,17 @@ */ class Tests_Date_wpTimezone extends WP_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset changed options to their default value. + update_option( 'gmt_offset', 0 ); + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * @ticket 24730 * diff --git a/tests/phpunit/tests/date/xmlrpc.php b/tests/phpunit/tests/date/xmlrpc.php index 6344265e1f..26285aa403 100644 --- a/tests/phpunit/tests/date/xmlrpc.php +++ b/tests/phpunit/tests/date/xmlrpc.php @@ -8,6 +8,16 @@ */ class Tests_Date_XMLRPC extends WP_XMLRPC_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset the timezone option to the default value. + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * @ticket 30429 * diff --git a/tests/phpunit/tests/formatting/date.php b/tests/phpunit/tests/formatting/date.php index 32e68d8f1a..c08a94710c 100644 --- a/tests/phpunit/tests/formatting/date.php +++ b/tests/phpunit/tests/formatting/date.php @@ -6,6 +6,17 @@ */ class Tests_Formatting_Date extends WP_UnitTestCase { + /** + * Cleans up. + */ + public function tear_down() { + // Reset changed options to their default value. + update_option( 'gmt_offset', 0 ); + update_option( 'timezone_string', '' ); + + parent::tear_down(); + } + /** * Unpatched, this test passes only when Europe/London is not observing DST. *