/** * Do not use directly - use $this->setTimezone('xx', $tz) instead in your test case. * @param string $tz valid timezone name */ public static function phpunit_override_default_php_timezone($tz) { if (!defined('PHPUNIT_TEST')) { throw new coding_exception('core_date::phpunit_override_default_php_timezone() must be used only from unit tests'); } $result = timezone_open($tz); // This triggers error if $tz invalid. if ($result !== false) { self::$defaultphptimezone = $tz; } else { self::$defaultphptimezone = 'Australia/Perth'; } }