Skip to content

Commit

Permalink
MDL-54008 timezone: Updating references to Caracas tz.
Browse files Browse the repository at this point in the history
I've removed Caracas direct references because it would fail on
some systems, it would depend on how updated is the olson version
PHP is using.
  • Loading branch information
David Monllao committed May 2, 2016
1 parent 4039f94 commit e50f5d5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion lib/classes/date.php
Expand Up @@ -532,7 +532,6 @@ protected static function init_zones() {
}

// Legacy Moodle half an hour offsets - pick any city nearby, ideally without DST.
self::$badzones['-4.5'] = 'America/Caracas';
self::$badzones['4.5'] = 'Asia/Kabul';
self::$badzones['5.5'] = 'Asia/Kolkata';
self::$badzones['6.5'] = 'Asia/Rangoon';
Expand Down
3 changes: 1 addition & 2 deletions lib/tests/date_legacy_test.php
Expand Up @@ -142,10 +142,9 @@ public function test_get_timezone_offset() {
$this->assertSame(60 * 60 * 1, get_timezone_offset('Europe/Prague'));
$this->assertSame(60 * 60 * 8, get_timezone_offset('Australia/Perth'));
$this->assertSame(60 * 60 * 12, get_timezone_offset('Pacific/Auckland'));
$this->assertSame(60 * 60 * -4, get_timezone_offset('-4'));

// Known half an hour offsets.
$this->assertEquals(60 * 60 * -4.5, get_timezone_offset('-4.5'));
$this->assertEquals(60 * 60 * -4.5, get_timezone_offset('America/Caracas'));
$this->assertEquals(60 * 60 * 4.5, get_timezone_offset('4.5'));
$this->assertEquals(60 * 60 * 4.5, get_timezone_offset('Asia/Kabul'));
$this->assertEquals(60 * 60 * 5.5, get_timezone_offset('5.5'));
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/date_test.php
Expand Up @@ -67,6 +67,7 @@ public function test_normalise_timezone() {
$this->assertSame('Etc/GMT-2', core_date::normalise_timezone('2.0'));
$this->assertSame('Etc/GMT+2', core_date::normalise_timezone(-2));
$this->assertSame('Etc/GMT+2', core_date::normalise_timezone('-2.0'));
$this->assertSame('Etc/GMT+4', core_date::normalise_timezone(-4));
$this->assertSame('Etc/GMT-2', core_date::normalise_timezone('UTC+2'));
$this->assertSame('Etc/GMT+2', core_date::normalise_timezone('UTC-2'));
$this->assertSame('Etc/GMT-2', core_date::normalise_timezone('GMT+2'));
Expand All @@ -78,7 +79,6 @@ public function test_normalise_timezone() {
$this->assertSame('Etc/GMT-13', core_date::normalise_timezone(13));
$this->assertSame('Pacific/Auckland', core_date::normalise_timezone(14));

$this->assertSame('America/Caracas', core_date::normalise_timezone(-4.5));
$this->assertSame('Asia/Kabul', core_date::normalise_timezone(4.5));
$this->assertSame('Asia/Kolkata', core_date::normalise_timezone(5.5));
$this->assertSame('Asia/Rangoon', core_date::normalise_timezone(6.5));
Expand Down
4 changes: 2 additions & 2 deletions lib/tests/fixtures/timezonewindows.xml
Expand Up @@ -116,7 +116,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<mapZone other="US Eastern Standard Time" territory="001" type="America/Indianapolis"/>
<mapZone other="US Eastern Standard Time" territory="US" type="America/Indianapolis America/Indiana/Marengo America/Indiana/Vevay"/>

<!-- (UTC-04:30) Caracas -->
<!-- (UTC-04:00) Caracas -->
<mapZone other="Venezuela Standard Time" territory="001" type="America/Caracas"/>
<mapZone other="Venezuela Standard Time" territory="VE" type="America/Caracas"/>

Expand Down Expand Up @@ -672,4 +672,4 @@ For terms of use, see http://www.unicode.org/copyright.html
<mapZone other="Line Islands Standard Time" territory="ZZ" type="Etc/GMT-14"/>
</mapTimezones>
</windowsZones>
</supplementalData>
</supplementalData>
8 changes: 4 additions & 4 deletions lib/tests/scheduled_task_test.php
Expand Up @@ -127,7 +127,7 @@ public function test_timezones() {
// The timezones used in this test are chosen because they do not use DST - that would break the test.
$this->resetAfterTest();

$this->setTimezone('America/Caracas');
$this->setTimezone('Asia/Kabul');

$testclass = new \core\task\scheduled_test_task();

Expand All @@ -143,9 +143,9 @@ public function test_timezones() {
$userdate = userdate($nexttime);

// Should be displayed in user timezone.
// I used http://www.timeanddate.com/worldclock/fixedtime.html?msg=Moodle+Test&iso=20140314T01&p1=58
// to verify this time.
$this->assertContains('11:15 AM', core_text::strtoupper($userdate));
// I used http://www.timeanddate.com/worldclock/fixedtime.html?msg=Moodle+Test&iso=20160502T01&p1=113
// setting my location to Kathmandu to verify this time.
$this->assertContains('2:15 AM', core_text::strtoupper($userdate));
}

public function test_reset_scheduled_tasks_for_component() {
Expand Down

0 comments on commit e50f5d5

Please sign in to comment.