diff --git a/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php b/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php new file mode 100644 index 0000000000000..0984b4b666925 --- /dev/null +++ b/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php @@ -0,0 +1,51 @@ +assertFalse( wp_timezone_override_offset() ); + } + + /** + * @ticket 59980 + */ + public function test_wp_timezone_override_offset_with_bad_option_set() { + update_option( 'timezone_string', 'BAD_TIME_ZONE' ); + $this->assertFalse( wp_timezone_override_offset() ); + } + + + /** + * @ticket 59980 + */ + public function test_wp_timezone_override_offset_with_EST_option_set() { + update_option( 'timezone_string', 'EST' ); + $offset = wp_timezone_override_offset(); + $this->assertIsFloat( $offset ); + $this->assertEquals( -5, $offset ); + } + /** + * @ticket 59980 + */ + public function test_wp_timezone_override_offset_with_NST_option_set() { + update_option( 'timezone_string', 'America/St_Johns' ); + $offset = wp_timezone_override_offset(); + $this->assertIsFloat( $offset ); + $this->assertEquals( -3.5, $offset ); + } +}