Merge branch 'MDL-54008_master-normalise' of git://github.com/dmonllao/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 3 May 2016 07:56:58 +0000 (08:56 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 3 May 2016 07:56:58 +0000 (08:56 +0100)
lib/classes/date.php
lib/tests/date_legacy_test.php

index 6026bb9..3685809 100644 (file)
@@ -134,7 +134,7 @@ class core_date {
             // Convert to known zone.
             $tz = self::$badzones[$tz];
             $fixed = true;
-        } else if (is_number($tz)) {
+        } else if (is_numeric($tz)) {
             // Half hour numeric offsets were already tested, try rounding to integers here.
             $roundedtz = (string)(int)$tz;
             if (isset(self::$badzones[$roundedtz])) {
index 09ddf02..7584163 100644 (file)
@@ -339,5 +339,9 @@ class core_date_legacy_testcase extends advanced_testcase {
 
         $USER->timezone = 'Europe/Prague';
         $this->assertSame('Europe/Prague', usertimezone('99'));
+
+        // Checking fallback with an unexisting timezone.
+        $USER->timezone = '-9.23';
+        $this->assertSame('UTC-9', usertimezone('99'));
     }
 }