mirror of
git://develop.git.wordpress.org/
synced 2025-03-22 21:09:51 +01:00
Tests: Improve wp_timezone_override_offset()
unit tests.
Some checks are pending
Cleanup Pull Requests / Clean up pull requests (push) Waiting to run
Coding Standards / PHP coding standards (push) Waiting to run
Coding Standards / JavaScript coding standards (push) Waiting to run
Coding Standards / Slack Notifications (push) Blocked by required conditions
Coding Standards / Failed workflow tasks (push) Blocked by required conditions
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Waiting to run
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Waiting to run
End-to-end Tests / Slack Notifications (push) Blocked by required conditions
End-to-end Tests / Failed workflow tasks (push) Blocked by required conditions
JavaScript Tests / QUnit Tests (push) Waiting to run
JavaScript Tests / Slack Notifications (push) Blocked by required conditions
JavaScript Tests / Failed workflow tasks (push) Blocked by required conditions
Performance Tests / Determine Matrix (push) Waiting to run
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Blocked by required conditions
Performance Tests / Compare (push) Blocked by required conditions
Performance Tests / Slack Notifications (push) Blocked by required conditions
Performance Tests / Failed workflow tasks (push) Blocked by required conditions
PHP Compatibility / Check PHP compatibility (push) Waiting to run
PHP Compatibility / Slack Notifications (push) Blocked by required conditions
PHP Compatibility / Failed workflow tasks (push) Blocked by required conditions
PHPUnit Tests / PHP 7.2 (push) Waiting to run
PHPUnit Tests / PHP 7.3 (push) Waiting to run
PHPUnit Tests / PHP 7.4 (push) Waiting to run
PHPUnit Tests / PHP 8.0 (push) Waiting to run
PHPUnit Tests / PHP 8.1 (push) Waiting to run
PHPUnit Tests / PHP 8.2 (push) Waiting to run
PHPUnit Tests / PHP 8.3 (push) Waiting to run
PHPUnit Tests / PHP 8.4 (push) Waiting to run
PHPUnit Tests / html-api-html5lib-tests (push) Waiting to run
PHPUnit Tests / Slack Notifications (push) Blocked by required conditions
PHPUnit Tests / Failed workflow tasks (push) Blocked by required conditions
Test Build Processes / Core running from build (push) Waiting to run
Test Build Processes / Core running from src (push) Waiting to run
Test Build Processes / Gutenberg running from build (push) Waiting to run
Test Build Processes / Gutenberg running from src (push) Waiting to run
Test Build Processes / Slack Notifications (push) Blocked by required conditions
Test Build Processes / Failed workflow tasks (push) Blocked by required conditions
Some checks are pending
Cleanup Pull Requests / Clean up pull requests (push) Waiting to run
Coding Standards / PHP coding standards (push) Waiting to run
Coding Standards / JavaScript coding standards (push) Waiting to run
Coding Standards / Slack Notifications (push) Blocked by required conditions
Coding Standards / Failed workflow tasks (push) Blocked by required conditions
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Waiting to run
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Waiting to run
End-to-end Tests / Slack Notifications (push) Blocked by required conditions
End-to-end Tests / Failed workflow tasks (push) Blocked by required conditions
JavaScript Tests / QUnit Tests (push) Waiting to run
JavaScript Tests / Slack Notifications (push) Blocked by required conditions
JavaScript Tests / Failed workflow tasks (push) Blocked by required conditions
Performance Tests / Determine Matrix (push) Waiting to run
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Blocked by required conditions
Performance Tests / Compare (push) Blocked by required conditions
Performance Tests / Slack Notifications (push) Blocked by required conditions
Performance Tests / Failed workflow tasks (push) Blocked by required conditions
PHP Compatibility / Check PHP compatibility (push) Waiting to run
PHP Compatibility / Slack Notifications (push) Blocked by required conditions
PHP Compatibility / Failed workflow tasks (push) Blocked by required conditions
PHPUnit Tests / PHP 7.2 (push) Waiting to run
PHPUnit Tests / PHP 7.3 (push) Waiting to run
PHPUnit Tests / PHP 7.4 (push) Waiting to run
PHPUnit Tests / PHP 8.0 (push) Waiting to run
PHPUnit Tests / PHP 8.1 (push) Waiting to run
PHPUnit Tests / PHP 8.2 (push) Waiting to run
PHPUnit Tests / PHP 8.3 (push) Waiting to run
PHPUnit Tests / PHP 8.4 (push) Waiting to run
PHPUnit Tests / html-api-html5lib-tests (push) Waiting to run
PHPUnit Tests / Slack Notifications (push) Blocked by required conditions
PHPUnit Tests / Failed workflow tasks (push) Blocked by required conditions
Test Build Processes / Core running from build (push) Waiting to run
Test Build Processes / Core running from src (push) Waiting to run
Test Build Processes / Gutenberg running from build (push) Waiting to run
Test Build Processes / Gutenberg running from src (push) Waiting to run
Test Build Processes / Slack Notifications (push) Blocked by required conditions
Test Build Processes / Failed workflow tasks (push) Blocked by required conditions
Includes: * Using a data provider to reduce code repetition. * Correcting the `group` annotation. Follow-up to [59931]. See #59980. git-svn-id: https://develop.svn.wordpress.org/trunk@59936 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ac057e6c69
commit
e641b06f0f
@ -1,53 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests for the wp_timezone_override_offset function.
|
||||
* Tests for the wp_timezone_override_offset() function.
|
||||
*
|
||||
* @group Functions.php
|
||||
* @group functions
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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 ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user