Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test for wp_timezone_override_offset #5715

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php
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 );
}
}
Loading