diff --git a/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php b/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php index 3b92e8c6fe..33a740c243 100644 --- a/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php +++ b/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php @@ -1,53 +1,39 @@ assertSame( '', get_option( 'timezone_string' ) ); - $this->assertFalse( wp_timezone_override_offset() ); - } /** * @ticket 59980 + * + * @dataProvider data_wp_timezone_override_offset */ - public function test_wp_timezone_override_offset_with_bad_option_set() { - update_option( 'timezone_string', 'BAD_TIME_ZONE' ); - $this->assertFalse( wp_timezone_override_offset() ); + public function test_wp_timezone_override_offset( $timezone_string, $expected ) { + update_option( 'timezone_string', $timezone_string ); + $this->assertSame( $expected, wp_timezone_override_offset() ); } /** - * @ticket 59980 + * Data provider. + * + * @return array[] Test parameters { + * @type string $timezone_string Test value. + * @type string $expected Expected return value. + * } */ - 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 ); + public function data_wp_timezone_override_offset() { + return array( + 'no timezone string option set' => array( '', false ), + 'bad option set' => array( 'BAD_TIME_ZONE', false ), + 'UTC option set' => array( 'UTC', 0.0 ), + 'EST option set' => array( 'EST', -5.0 ), + 'NST option set' => array( 'America/St_Johns', -3.5 ), + ); } }