Issue #3393338 by Berdir, smustgrave: Provide backwards-compatibility for storage settings in FieldUiTestTrait::fieldUIAddNewField
parent
e2f9ad3fa3
commit
2771a3127d
|
@ -437,7 +437,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
|
||||
// Add a new comment field.
|
||||
$storage_edit = [
|
||||
'field_storage[subform][settings][comment_type]' => 'foobar',
|
||||
'settings[comment_type]' => 'foobar',
|
||||
];
|
||||
$this->fieldUIAddNewField('entity_test/structure/entity_test', 'foobar', 'Foobar', 'comment', $storage_edit);
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ class EntityReferenceAdminTest extends BrowserTestBase {
|
|||
$field_name = $this->randomMachineName();
|
||||
|
||||
$storage_edit = $field_edit = [];
|
||||
$storage_edit['field_storage[subform][settings][target_type]'] = $target_type;
|
||||
$storage_edit['settings[target_type]'] = $target_type;
|
||||
foreach ($bundles as $bundle) {
|
||||
$field_edit['settings[handler_settings][target_bundles][' . $bundle . ']'] = TRUE;
|
||||
}
|
||||
|
|
|
@ -84,8 +84,23 @@ trait FieldUiTestTrait {
|
|||
// Test Breadcrumbs.
|
||||
$this->getSession()->getPage()->findLink($label);
|
||||
|
||||
// Ensure that each array key in $storage_edit is prefixed with field_storage.
|
||||
$prefixed_storage_edit = [];
|
||||
foreach ($storage_edit as $key => $value) {
|
||||
if (str_starts_with($key, 'field_storage')) {
|
||||
$prefixed_storage_edit[$key] = $value;
|
||||
continue;
|
||||
}
|
||||
// If the key starts with settings, it needs to be prefixed differently.
|
||||
if (str_starts_with($key, 'settings[')) {
|
||||
$prefixed_storage_edit[str_replace('settings[', 'field_storage[subform][settings][', $key)] = $value;
|
||||
continue;
|
||||
}
|
||||
$prefixed_storage_edit['field_storage[subform][' . $key . ']'] = $value;
|
||||
}
|
||||
|
||||
// Second step: 'Storage settings' form.
|
||||
$this->submitForm($storage_edit, 'Update settings');
|
||||
$this->submitForm($prefixed_storage_edit, 'Update settings');
|
||||
|
||||
// Third step: 'Field settings' form.
|
||||
$this->submitForm($field_edit, 'Save settings');
|
||||
|
|
|
@ -302,7 +302,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
|
|||
|
||||
$name = $this->randomMachineName();
|
||||
$label = $this->randomMachineName();
|
||||
$storage_edit = ['field_storage[subform][settings][uri_scheme]' => 'private'];
|
||||
$storage_edit = ['settings[uri_scheme]' => 'private'];
|
||||
$this->fieldUIAddNewField('admin/structure/comment/manage/comment', $name, $label, 'file', $storage_edit);
|
||||
|
||||
// Manually clear cache on the tester side.
|
||||
|
|
|
@ -165,7 +165,7 @@ class LinkFieldUITest extends BrowserTestBase {
|
|||
$field_edit['default_value_input[field_' . $field_name . '][0][title]'] = 'Default title';
|
||||
}
|
||||
$storage_edit = [
|
||||
'field_storage[subform][cardinality_number]' => $cardinality,
|
||||
'cardinality_number' => $cardinality,
|
||||
];
|
||||
$this->fieldUIAddNewField($type_path, $field_name, $label, 'link', $storage_edit, $field_edit);
|
||||
|
||||
|
|
Loading…
Reference in New Issue