You are here

protected function DateTimeHandlerTestBase::setSiteTimezone in Drupal 8

Same name and namespace in other branches
  1. 9 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
Test year argument.
FilterDateTest::testDateIs in core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
Test date filter with date-only fields.
FilterDateTest::testDateOffsets in core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
Test offsets with date-only fields.

File

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

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();
}