mirror of
git://develop.git.wordpress.org/
synced 2025-03-22 21:09:51 +01:00
Date/Time: Add tests that cover the wp_timezone_override_offset()
function.
Props pbearne, audrasjb Fixes #59980 git-svn-id: https://develop.svn.wordpress.org/trunk@59931 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
87953e10e4
commit
dc21f5b889
53
tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php
Normal file
53
tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests for the wp_timezone_override_offset function.
|
||||
*
|
||||
* @group Functions.php
|
||||
*
|
||||
* @covers ::wp_timezone_override_offset
|
||||
*/
|
||||
class Tests_Functions_wpTimezoneOverrideOffset extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 59980
|
||||
*/
|
||||
public function test_wp_timezone_override_offset_with_no_timezone_string_option_set() {
|
||||
$this->assertSame( '', get_option( 'timezone_string' ) );
|
||||
$this->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_UTC_option_set() {
|
||||
update_option( 'timezone_string', 'UTC' );
|
||||
$offset = wp_timezone_override_offset();
|
||||
$this->assertSame( 0.0, $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->assertSame( -5.0, $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->assertSame( -3.5, $offset );
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user