You are here

protected function SchedulerUiTrait::setUpTimeZone in Lightning Scheduler 8

Sets the time zone.

Functional tests normally run in the Sydney, Australia time zone in order to catch time zone-related edge cases and bugs. However, the scheduler UI is extremely sensitive to time zones, so to reduce craziness it's best to set it to the time zone configured in php.ini.

Parameters

string $default: (optional) The time zone to set if none is configured in php.ini. Defaults to UTC.

2 calls to SchedulerUiTrait::setUpTimeZone()
TransitionTest::setUp in tests/src/FunctionalJavascript/TransitionTest.php
UiTest::setUp in tests/src/FunctionalJavascript/UiTest.php

File

tests/src/Traits/SchedulerUiTrait.php, line 26

Class

SchedulerUiTrait
Contains methods for interacting with the scheduler UI.

Namespace

Drupal\Tests\lightning_scheduler\Traits

Code

protected function setUpTimeZone($default = 'UTC') {
  $this
    ->config('system.date')
    ->clear('timezone.default')
    ->save();
  date_default_timezone_set(ini_get('date.timezone') ?: $default);
}