public function FieldSettingsTest::testConfigurableFieldStorageSettings in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Field/FieldSettingsTest.php \Drupal\system\Tests\Field\FieldSettingsTest::testConfigurableFieldStorageSettings()
@covers \Drupal\field\Entity\FieldStorageConfig::getSettings() @covers \Drupal\field\Entity\FieldStorageConfig::setSettings()
File
- core/
modules/ system/ src/ Tests/ Field/ FieldSettingsTest.php, line 58 - Contains \Drupal\system\Tests\Field\FieldSettingsTest.
Class
- FieldSettingsTest
- Tests field settings methods on field definition structures.
Namespace
Drupal\system\Tests\FieldCode
public function testConfigurableFieldStorageSettings() {
$field_storage = FieldStorageConfig::create([
'field_name' => 'test_field',
'entity_type' => 'entity_test',
'type' => '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',
];
$this
->assertEqual($field_storage
->getSettings(), $expected_settings);
// Change one single setting using setSettings(), and check that the other
// expected settings are still present.
$expected_settings['test_field_storage_setting'] = 'another test string';
$field_storage
->setSettings([
'test_field_storage_setting' => $expected_settings['test_field_storage_setting'],
]);
$this
->assertEqual($field_storage
->getSettings(), $expected_settings);
}