function DateTimeHandlerTestBase::setSiteTimezone

Same name in other branches
  1. 8.9.x core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setSiteTimezone()
  2. 10 core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setSiteTimezone()
  3. 11.x core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setSiteTimezone()

Sets the site timezone to a given timezone.

Parameters

string $timezone: The timezone identifier to set.

3 calls to DateTimeHandlerTestBase::setSiteTimezone()
ArgumentDateTimeTest::testDatetimeArgumentYear in core/modules/datetime/tests/src/Kernel/Views/ArgumentDateTimeTest.php
Tests year argument.
FilterDateTest::testDateIs in core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
Tests date filter with date-only fields.
FilterDateTest::testDateOffsets in core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
Tests offsets with date-only fields.

File

core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php, line 102

Class

DateTimeHandlerTestBase
Base class for testing datetime handlers.

Namespace

Drupal\Tests\datetime\Kernel\Views

Code

protected function setSiteTimezone($timezone) {
    // Set an explicit site timezone, and disallow per-user timezones.
    $this->config('system.date')
        ->set('timezone.user.configurable', 0)
        ->set('timezone.default', $timezone)
        ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.