public function DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser in Recurring Dates Field 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser()
- 3.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::testDefaultCurrentUser()
- 3.0.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\KernelCode
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);
}