You are here

public function DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser in Recurring Dates Field 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser()
  2. 3.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser()
  3. 3.1.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser()

Tests time zone from current user.

File

tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php, line 98

Class

DateRecurFieldItemDefaultValuesTest
Tests date_recur field with default values configured at the instance level.

Namespace

Drupal\Tests\date_recur\Kernel

Code

public function testDefaultCurrentUser() {
  $this->baseFieldOverride
    ->setDefaultValue([
    [
      'default_date_type' => 'relative',
      'default_date' => '12th April 2013 3pm',
      'default_end_date_type' => 'relative',
      'default_end_date' => '12th April 2013 4pm',
      'default_date_time_zone' => 'Europe/Oslo',
      'default_time_zone' => '',
    ],
  ]);
  $this->baseFieldOverride
    ->save();
  $entity = DrEntityTest::create();
  $this
    ->assertEquals('2013-04-12T13:00:00', $entity->dr->value);
  $this
    ->assertEquals('2013-04-12T14:00:00', $entity->dr->end_value);
  $this
    ->assertEquals('Asia/Singapore', $entity->dr->timezone);
}