$this->
assertEquals(DateTimeItemInterface::STORAGE_TIMEZONE,
$entity->field_datetime->date->
getTimeZone()->
getName());
// Read changed entity and assert changed values.
$this->
entityValidateAndSave($entity);
$entity = EntityTest::
load($id);
$this->
assertEquals($new_value,
$entity->field_datetime->value
);
$this->
assertEquals(DateTimeItemInterface::STORAGE_TIMEZONE,
$entity->field_datetime
[0
]->
getProperties()['value'
]->
getDateTime()->
getTimeZone()->
getName());
$this->
assertEquals(DateTimeItemInterface::STORAGE_TIMEZONE,
$entity->field_datetime->date->
getTimeZone()->
getName());
// Test the generateSampleValue() method.
$entity = EntityTest::
create();
$entity->field_datetime->
generateSampleItems();
$this->
entityValidateAndSave($entity);
} /**
* Tests using entity fields of the date field type.
*/
public function testDateOnly() { $this->fieldStorage->
setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE
);
$this->fieldStorage->
save();
// Verify entity creation.