public function test_get_default_php_timezone() { $this->resetAfterTest(); $origtz = core_date::get_default_php_timezone(); $this->assertNotEmpty($origtz); $this->setTimezone('Pacific/Auckland', 'Europe/Prague'); $this->assertSame('Europe/Prague', core_date::get_default_php_timezone()); $this->setTimezone('Pacific/Auckland', 'UTC'); $this->assertSame('UTC', core_date::get_default_php_timezone()); $this->setTimezone('Pacific/Auckland', 'GMT'); $this->assertSame('GMT', core_date::get_default_php_timezone()); }
/** * Lazy load timezone options. * @return bool true if loaded, false if error */ public function load_choices() { global $CFG; if (is_array($this->choices)) { return true; } $current = isset($CFG->timezone) ? $CFG->timezone : null; $this->choices = core_date::get_list_of_timezones($current, false); if ($current == 99) { // Do not show 99 unless it is current value, we want to get rid of it over time. $this->choices['99'] = new lang_string('timezonephpdefault', 'core_admin', core_date::get_default_php_timezone()); } return true; }