You are here

protected function DateTestBase::setSiteTimezone in Drupal 8

Same name in this branch
  1. 8 core/modules/datetime/src/Tests/DateTestBase.php \Drupal\datetime\Tests\DateTestBase::setSiteTimezone()
  2. 8 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
Same name and namespace in other branches
  1. 9 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
  2. 10 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()

Sets the site timezone to a given timezone.

Parameters

string $timezone: The timezone identifier to set.

3 calls to DateTestBase::setSiteTimezone()
DateRangeFieldTest::testDateRangeField in core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
Tests date field functionality.
DateTimeFieldTest::testDateField in core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
Tests date field functionality.
DateTimeFieldTest::testDefaultValue in core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
Test default value functionality.

File

core/modules/datetime/tests/src/Functional/DateTestBase.php, line 183

Class

DateTestBase
Provides a base class for testing Datetime field functionality.

Namespace

Drupal\Tests\datetime\Functional

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