MDL-54008 timezone: Updating references to Caracas tz.
authorDavid Monllao <davidm@moodle.com>
Mon, 2 May 2016 04:37:32 +0000 (12:37 +0800)
committerDavid Monllao <davidm@moodle.com>
Mon, 2 May 2016 07:08:54 +0000 (15:08 +0800)
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.

lib/classes/date.php
lib/tests/date_test.php
lib/tests/fixtures/timezonewindows.xml
lib/tests/scheduled_task_test.php

index bdfec8d..6026bb9 100644 (file)
@@ -532,7 +532,6 @@ class core_date {
         }
 
         // 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';
index dc0560b..3e4d908 100644 (file)
@@ -67,6 +67,7 @@ class core_date_testcase extends advanced_testcase {
         $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'));
@@ -78,7 +79,6 @@ class core_date_testcase extends advanced_testcase {
         $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));
index cae95f6..a2d4a3e 100644 (file)
@@ -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"/>
 
@@ -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>
\ No newline at end of file
+</supplementalData>
index 7f3b150..2dc039c 100644 (file)
@@ -127,7 +127,7 @@ class core_scheduled_task_testcase extends advanced_testcase {
         // 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();
 
@@ -143,9 +143,9 @@ class core_scheduled_task_testcase extends advanced_testcase {
         $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() {