mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test for wp_timezone_override_offset
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* Tests for the wp_timezone_override_offset function. | ||
* | ||
* @group Functions.php | ||
* | ||
* @covers ::wp_timezone_override_offset | ||
*/ | ||
class Tests_Functions_wpTimezoneOverrideOffset extends WP_UnitTestCase { | ||
|
||
public function tear_down() { | ||
delete_option( 'timezone_string' ); | ||
parent::tear_down(); | ||
} | ||
|
||
/** | ||
* @ticket 59980 | ||
*/ | ||
public function test_wp_timezone_override_offset() { | ||
$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_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 ); | ||
} | ||
} |