function FieldSettingsTest::testBaseFieldSettings
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php \Drupal\KernelTests\Core\Field\FieldSettingsTest::testBaseFieldSettings()
- 10 core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php \Drupal\KernelTests\Core\Field\FieldSettingsTest::testBaseFieldSettings()
- 11.x core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php \Drupal\KernelTests\Core\Field\FieldSettingsTest::testBaseFieldSettings()
@covers \Drupal\Core\Field\BaseFieldDefinition::getSettings @covers \Drupal\Core\Field\BaseFieldDefinition::setSettings
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Field/ FieldSettingsTest.php, line 28
Class
- FieldSettingsTest
- Tests field settings methods on field definition structures.
Namespace
Drupal\KernelTests\Core\FieldCode
public function testBaseFieldSettings() {
$base_field = BaseFieldDefinition::create('test_field');
// Check that the default settings have been populated.
$expected_settings = [
'test_field_storage_setting' => 'dummy test string',
'changeable' => 'a changeable field storage setting',
'unchangeable' => 'an unchangeable field storage setting',
'translatable_storage_setting' => 'a translatable field storage setting',
'test_field_setting' => 'dummy test string',
'translatable_field_setting' => 'a translatable field setting',
];
$this->assertEqual($base_field->getSettings(), $expected_settings);
// Change one single setting using setSettings(), and check that the other
// expected settings are still present.
$expected_settings['test_field_setting'] = 'another test string';
$base_field->setSettings([
'test_field_setting' => $expected_settings['test_field_setting'],
]);
$this->assertEqual($base_field->getSettings(), $expected_settings);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.