From c84d32ac400ed92355b5e491be0c247dd892b52c Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Fri, 18 Mar 2022 05:36:47 +0100 Subject: [PATCH 01/19] OEL-1281: Add upgrade path from oe_bootstrap_theme_paragraphs. --- .../oe_whitelabel_paragraphs.install | 162 +++++++++++++++++- 1 file changed, 159 insertions(+), 3 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index a6ba792d..d9a575e6 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -7,19 +7,49 @@ declare(strict_types = 1); +use Drupal\field\Entity\FieldConfig; use Drupal\oe_bootstrap_theme\ConfigImporter; /** * Implements hook_install(). * - * Customise fields for whitelabel paragraphs. + * Customize paragraphs fields and display configuration. */ -function oe_whitelabel_paragraphs_install($is_syncing): void { - // If we are installing from config, we bail out. +function oe_whitelabel_paragraphs_install(bool $is_syncing): void { + // Find legacy fields from oe_bootstrap_theme_paragraphs. + // This needs to happen at the start, to allow for early abort. + $field_names_by_bundle = _oe_whitelabel_paragraphs_install_get_legacy_fields_map(); + if ($is_syncing) { + // The module is being installed as part of a config import. + if ($field_names_by_bundle) { + // There is data to be migrated. This should not happen as a side effect + // of config-import. Instead, the installation should be enacted from an + // update hook. + throw new \Exception('This module should be installed through an update hook, not through config-import, if there is still leftover data from oe_bootstrap_theme_paragraphs to migrate.'); + } + // No data needs to be migrated, but still, no configuration should be + // imported in hook_install() during config-import. + return; + } + + // The module is being installed explicitly, e.g. via a hook_update_N(). + // Configuration needs to be imported explicitly. + _oe_whitelabel_paragraphs_install_config(); + + if (!$field_names_by_bundle) { + // No fields to migrate and clean up - finished. return; } + _oe_whitelabel_paragraphs_install_migrate_field_data($field_names_by_bundle); + _oe_whitelabel_paragraphs_install_drop_legacy_fields($field_names_by_bundle); +} + +/** + * Imports configuration on module install. + */ +function _oe_whitelabel_paragraphs_install_config(): void { $configs = [ 'core.entity_form_display.paragraph.oe_accordion_item.default', 'core.entity_form_display.paragraph.oe_description_list.default', @@ -39,3 +69,129 @@ function oe_whitelabel_paragraphs_install($is_syncing): void { ConfigImporter::importMultiple('oe_whitelabel_paragraphs', '/config/overrides/', $configs); } + +/** + * Gets a map of legacy fields to be migrated on install. + * + * @return string[][] + * Format: $[$bundle][$dest_field_name] = $legacy_field_name. + * Empty, if oe_bootstrap_theme_paragraphs was not installed in the past. + */ +function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { + /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */ + $entity_field_manager = \Drupal::service('entity_field.manager'); + /** + * @var array[] $fields_map + * Format: $[$field_name] = [ + * 'type' => $field_type, + * 'bundles' => [$bundle_name => $bundle_name, ...], + * ]. + */ + $fields_map = $entity_field_manager->getFieldMap()['paragraph'] ?? []; + + $field_names_map = [ + 'oe_w_links_block_background' => 'oe_bt_links_block_background', + 'oe_w_links_block_orientation' => 'oe_bt_links_block_orientation', + 'oe_w_n_columns' => 'oe_bt_n_columns', + 'oe_w_orientation' => 'oe_bt_orientation', + ]; + + /** + * @var string[][] $field_names_by_bundle + * Format: $[$bundle][$dest_field_name] = $source_field_name. + */ + $field_names_by_bundle = []; + foreach ($field_names_map as $dest_field_name => $source_field_name) { + if (!isset($fields_map[$source_field_name])) { + // No field to migrate from. + continue; + } + if (!isset($fields_map[$dest_field_name])) { + // No target field to migrate to - this is unexpected. + continue; + } + // Find bundles where both source and destination fields exist. + foreach (array_intersect_key( + $fields_map[$dest_field_name]['bundles'], + $fields_map[$source_field_name]['bundles'], + ) as $bundle) { + $field_names_by_bundle[$bundle][$dest_field_name] = $source_field_name; + } + } + + return $field_names_by_bundle; +} + +/** + * Migrates field data from the old oe_bootstrap_theme_paragraphs module. + * + * Normally this should happen through a batch process, e.g. via $sandbox in a + * hook_update_N(). Unfortunately, hook_install() does not support batch + * processes. + * For the known projects where this will be used, we assume that not too many + * paragraphs exist yet - fingers crossed. + * + * See https://atendesigngroup.com/articles/programmatically-copy-field-data-drupal-8. + * + * @param string[][] $field_names_by_bundle + * Format: $[$bundle][$dest_field_name] = $source_field_name. + */ +function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names_by_bundle): void { + $paragraphs_storage = \Drupal::entityTypeManager()->getStorage('paragraph'); + + // Load all the paragraph ids. + $query = $paragraphs_storage->getQuery(); + $query->allRevisions(); + $query->condition('type', array_keys($field_names_by_bundle), 'IN'); + $paragraph_ids = $query->execute(); + + foreach ($paragraph_ids as $revision_id => $paragraph_id) { + $paragraph_revision = $paragraphs_storage->loadRevision($revision_id); + if (!$paragraph_revision) { + // Revision not found - this is unexpected, but survivable. + continue; + } + $modified = FALSE; + foreach ($field_names_by_bundle[$paragraph_revision->bundle()] ?? [] as $dest_field_name => $source_field_name) { + if ($paragraph_revision->get($source_field_name)->isEmpty()) { + // Source field has no data. + continue; + } + if (!$paragraph_revision->get($dest_field_name)->isEmpty()) { + // Destination already has data. + continue; + } + // Copy the field value. + // For these simple field types, magic __set() does the job. + $paragraph_revision->$dest_field_name = $paragraph_revision->$source_field_name; + // Do not unset the old field, because it might be required. + // Remember that the revision needs saving. + $modified = TRUE; + } + if (!$modified) { + // No saving is needed. + continue; + } + $paragraph_revision->setNewRevision(FALSE); + $paragraph_revision->save(); + } +} + +/** + * Removes legacy field instances from oe_bootstrap_theme_paragraphs module. + * + * @param string[][] $field_names_by_bundle + * Format: $[$bundle][*] = $source_field_name. + */ +function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names_by_bundle): void { + foreach ($field_names_by_bundle as $bundle => $field_names) { + foreach ($field_names as $field_name) { + $definition = FieldConfig::loadByName('paragraph', $bundle, $field_name); + if ($definition === NULL) { + // Field no longer exists. This is unexpected, but can be ignored. + continue; + } + $definition->delete(); + } + } +} -- GitLab From 17cee2b41bfacfb125804d653970acc06480810f Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Fri, 18 Mar 2022 05:37:57 +0100 Subject: [PATCH 02/19] OEL-1281: Add test for upgrade path. Example code found here: https://git.drupalcode.org/project/nopremium/-/blob/8.x-1.x/tests/src/Functional/InstallTest.php --- ....oe_description_list.oe_bt_orientation.yml | 22 ++ ...graph.oe_facts_figures.oe_bt_n_columns.yml | 24 +++ ...nks_block.oe_bt_links_block_background.yml | 22 ++ ...ks_block.oe_bt_links_block_orientation.yml | 22 ++ ...ia_follow.oe_bt_links_block_background.yml | 22 ++ ...paragraph.oe_bt_links_block_background.yml | 26 +++ ...aragraph.oe_bt_links_block_orientation.yml | 26 +++ ...ield.storage.paragraph.oe_bt_n_columns.yml | 19 ++ ...ld.storage.paragraph.oe_bt_orientation.yml | 26 +++ ...ay.paragraph.oe_accordion_item.default.yml | 36 ++++ ....paragraph.oe_description_list.default.yml | 38 ++++ ...lay.paragraph.oe_facts_figures.default.yml | 61 ++++++ ...splay.paragraph.oe_links_block.default.yml | 48 +++++ ...display.paragraph.oe_list_item.default.yml | 71 ++++++ ...y.paragraph.oe_list_item_block.default.yml | 67 ++++++ ...paragraph.oe_list_item_block.highlight.yml | 68 ++++++ ...ragraph.oe_social_media_follow.default.yml | 57 +++++ ...ay.paragraph.oe_accordion_item.default.yml | 32 +++ ....paragraph.oe_description_list.default.yml | 32 +++ ...lay.paragraph.oe_facts_figures.default.yml | 48 +++++ ...splay.paragraph.oe_links_block.default.yml | 39 ++++ ...ragraph.oe_social_media_follow.default.yml | 53 +++++ ...a_follow.field_oe_social_media_variant.yml | 22 ++ ...whitelabel_legacy_paragraphs_test.info.yml | 23 ++ ..._whitelabel_legacy_paragraphs_test.install | 40 ++++ .../tests/src/Functional/InstallTest.php | 203 ++++++++++++++++++ 26 files changed, 1147 insertions(+) create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_description_list.oe_bt_orientation.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_facts_figures.oe_bt_n_columns.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_background.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_orientation.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_background.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_orientation.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_n_columns.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_orientation.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml create mode 100755 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml create mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install create mode 100644 modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_description_list.oe_bt_orientation.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_description_list.oe_bt_orientation.yml new file mode 100644 index 00000000..73b09a47 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_description_list.oe_bt_orientation.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.oe_bt_orientation + - paragraphs.paragraphs_type.oe_description_list + module: + - options +id: paragraph.oe_description_list.oe_bt_orientation +field_name: oe_bt_orientation +entity_type: paragraph +bundle: oe_description_list +label: Orientation +description: 'Sets the orientation (vertical|horizontal) for the paragraph.' +required: true +translatable: false +default_value: + - + value: horizontal +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_facts_figures.oe_bt_n_columns.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_facts_figures.oe_bt_n_columns.yml new file mode 100644 index 00000000..eec70a14 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_facts_figures.oe_bt_n_columns.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.oe_bt_n_columns + - paragraphs.paragraphs_type.oe_facts_figures +id: paragraph.oe_facts_figures.oe_bt_n_columns +field_name: oe_bt_n_columns +entity_type: paragraph +bundle: oe_facts_figures +label: 'Number of columns' +description: 'Sets the number of grid columns. Minimum number is 1 column and maximum is 3.' +required: false +translatable: false +default_value: + - + value: 1 +default_value_callback: '' +settings: + min: 1 + max: 3 + prefix: '' + suffix: '' +field_type: integer diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_background.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_background.yml new file mode 100644 index 00000000..de66c697 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_background.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.oe_bt_links_block_background + - paragraphs.paragraphs_type.oe_links_block + module: + - options +id: paragraph.oe_links_block.oe_bt_links_block_background +field_name: oe_bt_links_block_background +entity_type: paragraph +bundle: oe_links_block +label: Background +description: 'Allows to select the background color of the links block.' +required: false +translatable: false +default_value: + - + value: gray +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_orientation.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_orientation.yml new file mode 100644 index 00000000..610c35d3 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_links_block.oe_bt_links_block_orientation.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.oe_bt_links_block_orientation + - paragraphs.paragraphs_type.oe_links_block + module: + - options +id: paragraph.oe_links_block.oe_bt_links_block_orientation +field_name: oe_bt_links_block_orientation +entity_type: paragraph +bundle: oe_links_block +label: Orientation +description: 'Allows to select the direction of the links block.' +required: false +translatable: false +default_value: + - + value: vertical +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background.yml new file mode 100644 index 00000000..8e167195 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.oe_bt_links_block_background + - paragraphs.paragraphs_type.oe_social_media_follow + module: + - options +id: paragraph.oe_social_media_follow.oe_bt_links_block_background +field_name: oe_bt_links_block_background +entity_type: paragraph +bundle: oe_social_media_follow +label: Background +description: 'Allows to select the background color of the Social Media Links block.' +required: false +translatable: false +default_value: + - + value: gray +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_background.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_background.yml new file mode 100644 index 00000000..1a7dbec0 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_background.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.oe_bt_links_block_background +field_name: oe_bt_links_block_background +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: gray + label: Gray + - + value: transparent + label: Transparent + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_orientation.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_orientation.yml new file mode 100644 index 00000000..d582eb81 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_links_block_orientation.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.oe_bt_links_block_orientation +field_name: oe_bt_links_block_orientation +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: horizontal + label: Horizontal + - + value: vertical + label: Vertical + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_n_columns.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_n_columns.yml new file mode 100644 index 00000000..f2a74071 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_n_columns.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.oe_bt_n_columns +field_name: oe_bt_n_columns +entity_type: paragraph +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_orientation.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_orientation.yml new file mode 100644 index 00000000..94f290a8 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/install/field.storage.paragraph.oe_bt_orientation.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + module: + - options + - paragraphs +id: paragraph.oe_bt_orientation +field_name: oe_bt_orientation +entity_type: paragraph +type: list_string +settings: + allowed_values: + - + value: vertical + label: Vertical + - + value: horizontal + label: Horizontal + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml new file mode 100644 index 00000000..3b7368e6 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml @@ -0,0 +1,36 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_accordion_item.field_oe_icon + - field.field.paragraph.oe_accordion_item.field_oe_text + - field.field.paragraph.oe_accordion_item.field_oe_text_long + - paragraphs.paragraphs_type.oe_accordion_item + module: + - text +id: paragraph.oe_accordion_item.default +targetEntityType: paragraph +bundle: oe_accordion_item +mode: default +content: + field_oe_text: + weight: 0 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + field_oe_text_long: + weight: 1 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: text_textarea + region: content +hidden: + created: true + field_oe_icon: true + status: true + uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml new file mode 100644 index 00000000..363809de --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml @@ -0,0 +1,38 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_description_list.field_oe_description_list_items + - field.field.paragraph.oe_description_list.field_oe_title + - field.field.paragraph.oe_description_list.oe_bt_orientation + - paragraphs.paragraphs_type.oe_description_list + module: + - description_list_field +id: paragraph.oe_description_list.default +targetEntityType: paragraph +bundle: oe_description_list +mode: default +content: + field_oe_description_list_items: + weight: 2 + settings: { } + third_party_settings: { } + type: description_list_widget + region: content + field_oe_title: + weight: 1 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + oe_bt_orientation: + type: options_select + weight: 0 + region: content + settings: { } + third_party_settings: { } +hidden: + created: true + status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml new file mode 100644 index 00000000..96a0c1fb --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml @@ -0,0 +1,61 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_facts_figures.field_oe_link + - field.field.paragraph.oe_facts_figures.field_oe_paragraphs + - field.field.paragraph.oe_facts_figures.field_oe_title + - field.field.paragraph.oe_facts_figures.oe_bt_n_columns + - paragraphs.paragraphs_type.oe_facts_figures + module: + - link + - oe_paragraphs +id: paragraph.oe_facts_figures.default +targetEntityType: paragraph +bundle: oe_facts_figures +mode: default +content: + field_oe_link: + type: link_default + weight: 2 + region: content + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + field_oe_paragraphs: + type: oe_paragraphs_variants + weight: 8 + region: content + settings: + title: Paragraph + title_plural: Paragraphs + edit_mode: open + add_mode: dropdown + form_display_mode: default + default_paragraph_type: '' + closed_mode: summary + autocollapse: none + closed_mode_threshold: 0 + features: + collapse_edit_all: collapse_edit_all + duplicate: duplicate + third_party_settings: { } + field_oe_title: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + oe_bt_n_columns: + weight: 6 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content +hidden: + created: true + status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml new file mode 100644 index 00000000..1fab747a --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml @@ -0,0 +1,48 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_links_block.field_oe_links + - field.field.paragraph.oe_links_block.oe_bt_links_block_background + - field.field.paragraph.oe_links_block.oe_bt_links_block_orientation + - field.field.paragraph.oe_links_block.field_oe_text + - paragraphs.paragraphs_type.oe_links_block + module: + - link +id: paragraph.oe_links_block.default +targetEntityType: paragraph +bundle: oe_links_block +mode: default +content: + field_oe_links: + weight: 3 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + oe_bt_links_block_background: + weight: 1 + settings: { } + third_party_settings: { } + type: options_select + region: content + oe_bt_links_block_orientation: + weight: 0 + settings: { } + third_party_settings: { } + type: options_select + region: content + field_oe_text: + weight: 2 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content +hidden: + created: true + status: true + uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml new file mode 100644 index 00000000..a80ab707 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml @@ -0,0 +1,71 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_list_item.field_oe_date + - field.field.paragraph.oe_list_item.field_oe_image + - field.field.paragraph.oe_list_item.field_oe_link + - field.field.paragraph.oe_list_item.field_oe_meta + - field.field.paragraph.oe_list_item.field_oe_text_long + - field.field.paragraph.oe_list_item.field_oe_title + - image.style.thumbnail + - paragraphs.paragraphs_type.oe_list_item + module: + - allowed_formats + - image + - link + - text +id: paragraph.oe_list_item.default +targetEntityType: paragraph +bundle: oe_list_item +mode: default +content: + field_oe_image: + type: image_image + weight: 3 + region: content + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + field_oe_link: + type: link_default + weight: 0 + region: content + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + field_oe_meta: + type: string_textfield + weight: 4 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + field_oe_text_long: + type: text_textarea + weight: 2 + region: content + settings: + rows: 3 + placeholder: '' + third_party_settings: + allowed_formats: + hide_help: '1' + hide_guidelines: '1' + field_oe_title: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: + created: true + field_oe_date: true + status: true + translation: true + uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml new file mode 100644 index 00000000..6497f1fd --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml @@ -0,0 +1,67 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_list_item_block.field_oe_link + - field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout + - field.field.paragraph.oe_list_item_block.field_oe_paragraphs + - field.field.paragraph.oe_list_item_block.field_oe_title + - paragraphs.paragraphs_type.oe_list_item_block + module: + - link + - paragraphs +id: paragraph.oe_list_item_block.default +targetEntityType: paragraph +bundle: oe_list_item_block +mode: default +content: + field_oe_link: + type: link_default + weight: 3 + region: content + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + field_oe_list_item_block_layout: + type: options_select + weight: 0 + region: content + settings: { } + third_party_settings: { } + field_oe_paragraphs: + type: paragraphs + weight: 2 + region: content + settings: + title: Paragraph + title_plural: Paragraphs + edit_mode: closed + closed_mode: summary + autocollapse: none + closed_mode_threshold: 0 + add_mode: dropdown + form_display_mode: default + default_paragraph_type: oe_list_item + features: + add_above: '0' + collapse_edit_all: collapse_edit_all + duplicate: duplicate + third_party_settings: { } + field_oe_title: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + translation: + weight: 4 + region: content + settings: { } + third_party_settings: { } +hidden: + created: true + status: true + uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml new file mode 100644 index 00000000..28e0a334 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml @@ -0,0 +1,68 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_form_mode.paragraph.highlight + - field.field.paragraph.oe_list_item_block.field_oe_link + - field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout + - field.field.paragraph.oe_list_item_block.field_oe_paragraphs + - field.field.paragraph.oe_list_item_block.field_oe_title + - paragraphs.paragraphs_type.oe_list_item_block + module: + - link + - paragraphs +id: paragraph.oe_list_item_block.highlight +targetEntityType: paragraph +bundle: oe_list_item_block +mode: highlight +content: + field_oe_link: + type: link_default + weight: 3 + region: content + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + field_oe_list_item_block_layout: + type: options_select + weight: 0 + region: content + settings: { } + third_party_settings: { } + field_oe_paragraphs: + type: paragraphs + weight: 2 + region: content + settings: + title: Paragraph + title_plural: Paragraphs + edit_mode: closed + closed_mode: summary + autocollapse: none + closed_mode_threshold: 0 + add_mode: dropdown + form_display_mode: highlight + default_paragraph_type: oe_list_item + features: + add_above: '0' + collapse_edit_all: collapse_edit_all + duplicate: duplicate + third_party_settings: { } + field_oe_title: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + translation: + weight: 4 + region: content + settings: { } + third_party_settings: { } +hidden: + created: true + status: true + uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml new file mode 100644 index 00000000..8b7cd07f --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml @@ -0,0 +1,57 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_links + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_see_more + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant + - field.field.paragraph.oe_social_media_follow.field_oe_title + - paragraphs.paragraphs_type.oe_social_media_follow + module: + - link + - typed_link +id: paragraph.oe_social_media_follow.default +targetEntityType: paragraph +bundle: oe_social_media_follow +mode: default +content: + oe_bt_links_block_background: + type: options_select + weight: 1 + region: content + settings: { } + third_party_settings: { } + field_oe_social_media_links: + weight: 3 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: typed_link + region: content + field_oe_social_media_see_more: + weight: 4 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_oe_social_media_variant: + weight: 0 + settings: { } + third_party_settings: { } + type: options_select + region: content + field_oe_title: + weight: 2 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content +hidden: + created: true + status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml new file mode 100644 index 00000000..8c3a67f6 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml @@ -0,0 +1,32 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_accordion_item.field_oe_icon + - field.field.paragraph.oe_accordion_item.field_oe_text + - field.field.paragraph.oe_accordion_item.field_oe_text_long + - paragraphs.paragraphs_type.oe_accordion_item + module: + - text +id: paragraph.oe_accordion_item.default +targetEntityType: paragraph +bundle: oe_accordion_item +mode: default +content: + field_oe_text: + weight: 0 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + field_oe_text_long: + weight: 1 + label: above + settings: { } + third_party_settings: { } + type: text_default + region: content +hidden: + field_oe_icon: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml new file mode 100644 index 00000000..2e3b81d7 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml @@ -0,0 +1,32 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_description_list.oe_bt_orientation + - field.field.paragraph.oe_description_list.field_oe_description_list_items + - field.field.paragraph.oe_description_list.field_oe_title + - paragraphs.paragraphs_type.oe_description_list + module: + - description_list_field +id: paragraph.oe_description_list.default +targetEntityType: paragraph +bundle: oe_description_list +mode: default +content: + field_oe_description_list_items: + weight: 1 + label: hidden + settings: { } + third_party_settings: { } + type: description_list_formatter + region: content + field_oe_title: + weight: 0 + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: + oe_bt_orientation: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml new file mode 100644 index 00000000..e9dd9cf6 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml @@ -0,0 +1,48 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_facts_figures.field_oe_link + - field.field.paragraph.oe_facts_figures.field_oe_paragraphs + - field.field.paragraph.oe_facts_figures.field_oe_title + - field.field.paragraph.oe_facts_figures.oe_bt_n_columns + - paragraphs.paragraphs_type.oe_facts_figures + module: + - entity_reference_revisions + - link +id: paragraph.oe_facts_figures.default +targetEntityType: paragraph +bundle: oe_facts_figures +mode: default +content: + field_oe_link: + weight: 2 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_oe_paragraphs: + weight: 1 + label: above + settings: + view_mode: default + link: '' + third_party_settings: { } + type: entity_reference_revisions_entity_view + region: content + field_oe_title: + weight: 0 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: + oe_bt_n_columns: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml new file mode 100644 index 00000000..0d927d07 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml @@ -0,0 +1,39 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_links_block.field_oe_links + - field.field.paragraph.oe_links_block.field_oe_links_block_background + - field.field.paragraph.oe_links_block.field_oe_links_block_orientation + - field.field.paragraph.oe_links_block.field_oe_text + - paragraphs.paragraphs_type.oe_links_block + module: + - link +id: paragraph.oe_links_block.default +targetEntityType: paragraph +bundle: oe_links_block +mode: default +content: + field_oe_links: + weight: 1 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_oe_text: + weight: 0 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: + field_oe_links_block_background: true + field_oe_links_block_orientation: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml new file mode 100644 index 00000000..8e15a231 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml @@ -0,0 +1,53 @@ +langcode: en +status: true +dependencies: + config: + - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_links + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_see_more + - field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant + - field.field.paragraph.oe_social_media_follow.field_oe_title + - paragraphs.paragraphs_type.oe_social_media_follow + module: + - link + - typed_link +id: paragraph.oe_social_media_follow.default +targetEntityType: paragraph +bundle: oe_social_media_follow +mode: default +content: + field_oe_social_media_links: + weight: 1 + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: typed_link + region: content + field_oe_social_media_see_more: + weight: 2 + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_oe_title: + weight: 0 + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: + oe_bt_links_block_background: true + field_oe_social_media_variant: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml new file mode 100755 index 00000000..ecf09e79 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.paragraph.field_oe_social_media_variant + - paragraphs.paragraphs_type.oe_social_media_follow + module: + - options +id: paragraph.oe_social_media_follow.field_oe_social_media_variant +field_name: field_oe_social_media_variant +entity_type: paragraph +bundle: oe_social_media_follow +label: Orientation +description: '' +required: true +translatable: false +default_value: + - + value: horizontal +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml new file mode 100644 index 00000000..8cf1909b --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml @@ -0,0 +1,23 @@ +name: OE Whitelabel - Legacy Paragraphs Test +type: module +description: Provides legacy configuration as in oe_bootstrap_theme_paragraphs. +package: Testing +hidden: true +dependencies: + - oe_paragraphs:oe_paragraphs + - oe_bootstrap_theme:oe_bootstrap_theme_helper + - oe_paragraphs:oe_paragraphs_timeline + - oe_content:oe_content_timeline_field + - drupal:description_list_field + - oe_paragraphs:oe_paragraphs_description_list +config_devel: + install: + - field.field.paragraph.oe_links_block.oe_bt_links_block_background + - field.field.paragraph.oe_links_block.oe_bt_links_block_orientation + - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background + - field.field.paragraph.oe_facts_figures.oe_bt_n_columns + - field.storage.paragraph.oe_bt_links_block_orientation + - field.storage.paragraph.oe_bt_links_block_background + - field.field.paragraph.oe_description_list.oe_bt_orientation + - field.storage.paragraph.oe_bt_orientation + - field.storage.paragraph.oe_bt_n_columns diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install new file mode 100644 index 00000000..c80def17 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install @@ -0,0 +1,40 @@ +<?php + +/** + * @file + * Install and update functions for the OE Bootstrap Theme Paragraphs module. + */ + +declare(strict_types = 1); + +use Drupal\oe_bootstrap_theme\ConfigImporter; + +/** + * Implements hook_install(). + * + * Customise fields for bootstrap theme paragraphs. + */ +function oe_whitelabel_legacy_paragraphs_test_install($is_syncing): void { + // If we are installing from config, we bail out. + if ($is_syncing) { + return; + } + + $configs = [ + 'core.entity_form_display.paragraph.oe_links_block.default', + 'core.entity_form_display.paragraph.oe_social_media_follow.default', + 'core.entity_view_display.paragraph.oe_links_block.default', + 'core.entity_view_display.paragraph.oe_social_media_follow.default', + 'core.entity_form_display.paragraph.oe_description_list.default', + 'core.entity_view_display.paragraph.oe_description_list.default', + 'core.entity_form_display.paragraph.oe_accordion_item.default', + 'core.entity_view_display.paragraph.oe_accordion_item.default', + 'core.entity_form_display.paragraph.oe_facts_figures.default', + 'core.entity_view_display.paragraph.oe_facts_figures.default', + 'core.entity_form_display.paragraph.oe_list_item_block.default', + 'core.entity_form_display.paragraph.oe_list_item_block.highlight', + 'core.entity_form_display.paragraph.oe_list_item.default', + ]; + + ConfigImporter::importMultiple('oe_whitelabel_legacy_paragraphs_test', '/config/overrides/', $configs); +} diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php new file mode 100644 index 00000000..2da2d611 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -0,0 +1,203 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\Tests\oe_whitelabel_paragraphs\Functional; + +use Drupal\paragraphs\Entity\Paragraph; +use Drupal\Tests\BrowserTestBase; + +/** + * Tests installation of oe_whitelabel_paragraphs. + * + * @see oe_whitelabel_paragraphs_install() + */ +class InstallTest extends BrowserTestBase { + + /** + * Module handler to ensure installed modules. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** + * Module installer. + * + * @var \Drupal\Core\Extension\ModuleInstallerInterface + */ + protected $moduleInstaller; + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'node', + 'oe_whitelabel_legacy_paragraphs_test', + ]; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + $this->initServices(); + } + + /** + * Reloads services used by this test. + */ + protected function reloadServices(): void { + $this->rebuildContainer(); + $this->initServices(); + } + + /** + * Initializes services. + */ + protected function initServices(): void { + $this->moduleHandler = $this->container->get('module_handler'); + $this->moduleInstaller = $this->container->get('module_installer'); + } + + /** + * Test installation with legacy fields and data present. + */ + public function testInstallWithLegacyParagraphs(): void { + $paragraphs_data = []; + $paragraphs_data['oe_description_list'] = [ + 'type' => 'oe_description_list', + 'field_oe_title' => 'Description list paragraph', + // This field will be renamed. + 'oe_bt_orientation' => 'horizontal', + 'field_oe_description_list_items' => [ + // One item is enough for this test. + [ + 'term' => 'Aliquam ultricies', + 'description' => 'Donec et leo ac velit posuere tempor mattis ac mi. Vivamus nec dictum lectus. Aliquam ultricies placerat eros, vitae ornare sem.', + ], + ], + ]; + $paragraphs_data['oe_facts_figures'] = [ + 'type' => 'oe_facts_figures', + 'field_oe_title' => 'Fact and figures block', + 'field_oe_link' => [ + 'uri' => 'https://www.readmore.com', + 'title' => 'Read more', + ], + // This field will be renamed. + 'oe_bt_n_columns' => 3, + 'field_oe_paragraphs' => [ + 'type' => 'oe_fact', + 'field_oe_icon' => 'box-arrow-up', + 'field_oe_title' => '1529 JIRA Ticket', + 'field_oe_subtitle' => 'Jira Tickets', + 'field_oe_plain_text_long' => 'Nunc condimentum sapien ut nibh finibus suscipit vitae at justo. Morbi quis odio faucibus, commodo tortor id, elementum libero.', + ], + ]; + $paragraphs_data['oe_links_block'] = [ + 'type' => 'oe_links_block', + 'field_oe_text' => 'More information', + // These fields will be renamed. + 'oe_bt_links_block_orientation' => 'vertical', + 'oe_bt_links_block_background' => 'gray', + 'field_oe_links' => [ + // One link is enough for this test. + [ + 'title' => 'European Commission', + 'uri' => 'https://example.com', + ], + ], + ]; + $paragraphs_data['oe_social_media_follow'] = [ + 'type' => 'oe_social_media_follow', + 'field_oe_title' => 'Social media title', + 'field_oe_social_media_variant' => 'horizontal', + // This field will be renamed. + 'oe_bt_links_block_background' => 'gray', + // One link is enough for this test. + 'field_oe_social_media_links' => [ + [ + 'title' => 'Email', + 'uri' => 'mailto:example@com', + 'link_type' => 'email', + ], + ], + 'field_oe_social_media_see_more' => [ + 'title' => 'Other social networks', + 'uri' => 'https://europa.eu/european-union/contact/social-networks_en', + ], + ]; + + $ids = []; + foreach ($paragraphs_data as $name => $paragraph_data) { + $paragraph = Paragraph::create($paragraph_data); + $paragraph->save(); + $ids[$name] = $paragraph->id(); + } + + self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_legacy_paragraphs_test')); + self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); + self::assertTrue($this->moduleInstaller->install(['oe_whitelabel_paragraphs'])); + self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); + $this->reloadServices(); + self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); + + $expected_created = [ + 'oe_description_list' => [ + 'oe_w_orientation' => 'horizontal', + ], + 'oe_facts_figures' => [ + 'oe_w_n_columns' => '3', + ], + 'oe_links_block' => [ + 'oe_w_links_block_orientation' => 'vertical', + 'oe_w_links_block_background' => 'gray', + ], + 'oe_social_media_follow' => [ + 'oe_w_links_block_background' => 'gray', + ], + ]; + + $expected_deleted = [ + 'oe_description_list' => [ + 'oe_bt_orientation' => TRUE, + ], + 'oe_facts_figures' => [ + 'oe_bt_n_columns' => TRUE, + ], + 'oe_links_block' => [ + 'oe_bt_links_block_orientation' => TRUE, + 'oe_bt_links_block_background' => TRUE, + ], + 'oe_social_media_follow' => [ + 'oe_bt_links_block_background' => TRUE, + ], + ]; + + $actual_updated = []; + $actual_deleted = []; + foreach ($ids as $name => $id) { + $updated_paragraph = Paragraph::load($id); + self::assertNotNull($updated_paragraph); + foreach ($expected_created[$name] as $field_name => $value) { + if (!$updated_paragraph->hasField($field_name)) { + continue; + } + $actual_updated[$name][$field_name] = $updated_paragraph->get($field_name)->value; + } + foreach ($expected_deleted[$name] as $field_name => $deleted) { + $actual_deleted[$name][$field_name] = !$updated_paragraph->hasField($field_name); + } + } + + self::assertSame($expected_created, $actual_updated); + self::assertSame($expected_deleted, $actual_deleted); + } + +} -- GitLab From 998974e24bd8cd98bd6b26822b8faca99a174f0d Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 12:39:46 +0100 Subject: [PATCH 03/19] OEL-1281: Standardize docs in oe_whitelabel_paragraphs.install. --- .../oe_whitelabel_paragraphs.install | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index d9a575e6..5559c9cc 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -13,7 +13,10 @@ use Drupal\oe_bootstrap_theme\ConfigImporter; /** * Implements hook_install(). * - * Customize paragraphs fields and display configuration. + * Customizes paragraphs fields and display configuration. + * + * If oe_bootstrap_theme_paragraphs was installed in the past, this will also + * migrate field data and clean up fields that have been renamed. */ function oe_whitelabel_paragraphs_install(bool $is_syncing): void { // Find legacy fields from oe_bootstrap_theme_paragraphs. @@ -74,19 +77,14 @@ function _oe_whitelabel_paragraphs_install_config(): void { * Gets a map of legacy fields to be migrated on install. * * @return string[][] - * Format: $[$bundle][$dest_field_name] = $legacy_field_name. + * Legacy field names, indexed by paragraph type and destination field name. + * Only contains entries where both the legacy field name and the destination + * field name do exist. * Empty, if oe_bootstrap_theme_paragraphs was not installed in the past. */ function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */ $entity_field_manager = \Drupal::service('entity_field.manager'); - /** - * @var array[] $fields_map - * Format: $[$field_name] = [ - * 'type' => $field_type, - * 'bundles' => [$bundle_name => $bundle_name, ...], - * ]. - */ $fields_map = $entity_field_manager->getFieldMap()['paragraph'] ?? []; $field_names_map = [ @@ -98,7 +96,7 @@ function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { /** * @var string[][] $field_names_by_bundle - * Format: $[$bundle][$dest_field_name] = $source_field_name. + * Legacy field names, indexed by paragraph type and destination field name. */ $field_names_by_bundle = []; foreach ($field_names_map as $dest_field_name => $source_field_name) { @@ -125,16 +123,14 @@ function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { /** * Migrates field data from the old oe_bootstrap_theme_paragraphs module. * - * Normally this should happen through a batch process, e.g. via $sandbox in a + * This should happen through a batch process, e.g. via $sandbox in a * hook_update_N(). Unfortunately, hook_install() does not support batch * processes. - * For the known projects where this will be used, we assume that not too many - * paragraphs exist yet - fingers crossed. * * See https://atendesigngroup.com/articles/programmatically-copy-field-data-drupal-8. * * @param string[][] $field_names_by_bundle - * Format: $[$bundle][$dest_field_name] = $source_field_name. + * Legacy field names, indexed by paragraph type and destination field name. */ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names_by_bundle): void { $paragraphs_storage = \Drupal::entityTypeManager()->getStorage('paragraph'); @@ -181,7 +177,8 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names * Removes legacy field instances from oe_bootstrap_theme_paragraphs module. * * @param string[][] $field_names_by_bundle - * Format: $[$bundle][*] = $source_field_name. + * Legacy field names, indexed by paragraph type and destination field name. + * (The destination field name is not relevant for this function.) */ function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names_by_bundle): void { foreach ($field_names_by_bundle as $bundle => $field_names) { -- GitLab From b2eea8b5cde20349518d41f132dd5add87b3b9c7 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 13:00:36 +0100 Subject: [PATCH 04/19] OEL-1281: Remove useless config in test module. --- ...ay.paragraph.oe_accordion_item.default.yml | 36 ---------- ....paragraph.oe_description_list.default.yml | 38 ---------- ...lay.paragraph.oe_facts_figures.default.yml | 61 ---------------- ...splay.paragraph.oe_links_block.default.yml | 48 ------------- ...display.paragraph.oe_list_item.default.yml | 71 ------------------- ...y.paragraph.oe_list_item_block.default.yml | 67 ----------------- ...paragraph.oe_list_item_block.highlight.yml | 68 ------------------ ...ragraph.oe_social_media_follow.default.yml | 57 --------------- ...ay.paragraph.oe_accordion_item.default.yml | 32 --------- ....paragraph.oe_description_list.default.yml | 32 --------- ...lay.paragraph.oe_facts_figures.default.yml | 48 ------------- ...splay.paragraph.oe_links_block.default.yml | 39 ---------- ...ragraph.oe_social_media_follow.default.yml | 53 -------------- ...a_follow.field_oe_social_media_variant.yml | 22 ------ ..._whitelabel_legacy_paragraphs_test.install | 40 ----------- 15 files changed, 712 deletions(-) delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml delete mode 100755 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml delete mode 100644 modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml deleted file mode 100644 index 3b7368e6..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_accordion_item.default.yml +++ /dev/null @@ -1,36 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_accordion_item.field_oe_icon - - field.field.paragraph.oe_accordion_item.field_oe_text - - field.field.paragraph.oe_accordion_item.field_oe_text_long - - paragraphs.paragraphs_type.oe_accordion_item - module: - - text -id: paragraph.oe_accordion_item.default -targetEntityType: paragraph -bundle: oe_accordion_item -mode: default -content: - field_oe_text: - weight: 0 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content - field_oe_text_long: - weight: 1 - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - type: text_textarea - region: content -hidden: - created: true - field_oe_icon: true - status: true - uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml deleted file mode 100644 index 363809de..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_description_list.default.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_description_list.field_oe_description_list_items - - field.field.paragraph.oe_description_list.field_oe_title - - field.field.paragraph.oe_description_list.oe_bt_orientation - - paragraphs.paragraphs_type.oe_description_list - module: - - description_list_field -id: paragraph.oe_description_list.default -targetEntityType: paragraph -bundle: oe_description_list -mode: default -content: - field_oe_description_list_items: - weight: 2 - settings: { } - third_party_settings: { } - type: description_list_widget - region: content - field_oe_title: - weight: 1 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content - oe_bt_orientation: - type: options_select - weight: 0 - region: content - settings: { } - third_party_settings: { } -hidden: - created: true - status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml deleted file mode 100644 index 96a0c1fb..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_facts_figures.default.yml +++ /dev/null @@ -1,61 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_facts_figures.field_oe_link - - field.field.paragraph.oe_facts_figures.field_oe_paragraphs - - field.field.paragraph.oe_facts_figures.field_oe_title - - field.field.paragraph.oe_facts_figures.oe_bt_n_columns - - paragraphs.paragraphs_type.oe_facts_figures - module: - - link - - oe_paragraphs -id: paragraph.oe_facts_figures.default -targetEntityType: paragraph -bundle: oe_facts_figures -mode: default -content: - field_oe_link: - type: link_default - weight: 2 - region: content - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - field_oe_paragraphs: - type: oe_paragraphs_variants - weight: 8 - region: content - settings: - title: Paragraph - title_plural: Paragraphs - edit_mode: open - add_mode: dropdown - form_display_mode: default - default_paragraph_type: '' - closed_mode: summary - autocollapse: none - closed_mode_threshold: 0 - features: - collapse_edit_all: collapse_edit_all - duplicate: duplicate - third_party_settings: { } - field_oe_title: - type: string_textfield - weight: 1 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - oe_bt_n_columns: - weight: 6 - settings: - placeholder: '' - third_party_settings: { } - type: number - region: content -hidden: - created: true - status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml deleted file mode 100644 index 1fab747a..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_links_block.default.yml +++ /dev/null @@ -1,48 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_links_block.field_oe_links - - field.field.paragraph.oe_links_block.oe_bt_links_block_background - - field.field.paragraph.oe_links_block.oe_bt_links_block_orientation - - field.field.paragraph.oe_links_block.field_oe_text - - paragraphs.paragraphs_type.oe_links_block - module: - - link -id: paragraph.oe_links_block.default -targetEntityType: paragraph -bundle: oe_links_block -mode: default -content: - field_oe_links: - weight: 3 - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - type: link_default - region: content - oe_bt_links_block_background: - weight: 1 - settings: { } - third_party_settings: { } - type: options_select - region: content - oe_bt_links_block_orientation: - weight: 0 - settings: { } - third_party_settings: { } - type: options_select - region: content - field_oe_text: - weight: 2 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content -hidden: - created: true - status: true - uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml deleted file mode 100644 index a80ab707..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item.default.yml +++ /dev/null @@ -1,71 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_list_item.field_oe_date - - field.field.paragraph.oe_list_item.field_oe_image - - field.field.paragraph.oe_list_item.field_oe_link - - field.field.paragraph.oe_list_item.field_oe_meta - - field.field.paragraph.oe_list_item.field_oe_text_long - - field.field.paragraph.oe_list_item.field_oe_title - - image.style.thumbnail - - paragraphs.paragraphs_type.oe_list_item - module: - - allowed_formats - - image - - link - - text -id: paragraph.oe_list_item.default -targetEntityType: paragraph -bundle: oe_list_item -mode: default -content: - field_oe_image: - type: image_image - weight: 3 - region: content - settings: - progress_indicator: throbber - preview_image_style: thumbnail - third_party_settings: { } - field_oe_link: - type: link_default - weight: 0 - region: content - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - field_oe_meta: - type: string_textfield - weight: 4 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_oe_text_long: - type: text_textarea - weight: 2 - region: content - settings: - rows: 3 - placeholder: '' - third_party_settings: - allowed_formats: - hide_help: '1' - hide_guidelines: '1' - field_oe_title: - type: string_textfield - weight: 1 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } -hidden: - created: true - field_oe_date: true - status: true - translation: true - uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml deleted file mode 100644 index 6497f1fd..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.default.yml +++ /dev/null @@ -1,67 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_list_item_block.field_oe_link - - field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout - - field.field.paragraph.oe_list_item_block.field_oe_paragraphs - - field.field.paragraph.oe_list_item_block.field_oe_title - - paragraphs.paragraphs_type.oe_list_item_block - module: - - link - - paragraphs -id: paragraph.oe_list_item_block.default -targetEntityType: paragraph -bundle: oe_list_item_block -mode: default -content: - field_oe_link: - type: link_default - weight: 3 - region: content - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - field_oe_list_item_block_layout: - type: options_select - weight: 0 - region: content - settings: { } - third_party_settings: { } - field_oe_paragraphs: - type: paragraphs - weight: 2 - region: content - settings: - title: Paragraph - title_plural: Paragraphs - edit_mode: closed - closed_mode: summary - autocollapse: none - closed_mode_threshold: 0 - add_mode: dropdown - form_display_mode: default - default_paragraph_type: oe_list_item - features: - add_above: '0' - collapse_edit_all: collapse_edit_all - duplicate: duplicate - third_party_settings: { } - field_oe_title: - type: string_textfield - weight: 1 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - translation: - weight: 4 - region: content - settings: { } - third_party_settings: { } -hidden: - created: true - status: true - uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml deleted file mode 100644 index 28e0a334..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_list_item_block.highlight.yml +++ /dev/null @@ -1,68 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - core.entity_form_mode.paragraph.highlight - - field.field.paragraph.oe_list_item_block.field_oe_link - - field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout - - field.field.paragraph.oe_list_item_block.field_oe_paragraphs - - field.field.paragraph.oe_list_item_block.field_oe_title - - paragraphs.paragraphs_type.oe_list_item_block - module: - - link - - paragraphs -id: paragraph.oe_list_item_block.highlight -targetEntityType: paragraph -bundle: oe_list_item_block -mode: highlight -content: - field_oe_link: - type: link_default - weight: 3 - region: content - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - field_oe_list_item_block_layout: - type: options_select - weight: 0 - region: content - settings: { } - third_party_settings: { } - field_oe_paragraphs: - type: paragraphs - weight: 2 - region: content - settings: - title: Paragraph - title_plural: Paragraphs - edit_mode: closed - closed_mode: summary - autocollapse: none - closed_mode_threshold: 0 - add_mode: dropdown - form_display_mode: highlight - default_paragraph_type: oe_list_item - features: - add_above: '0' - collapse_edit_all: collapse_edit_all - duplicate: duplicate - third_party_settings: { } - field_oe_title: - type: string_textfield - weight: 1 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - translation: - weight: 4 - region: content - settings: { } - third_party_settings: { } -hidden: - created: true - status: true - uid: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml deleted file mode 100644 index 8b7cd07f..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_form_display.paragraph.oe_social_media_follow.default.yml +++ /dev/null @@ -1,57 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_links - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_see_more - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant - - field.field.paragraph.oe_social_media_follow.field_oe_title - - paragraphs.paragraphs_type.oe_social_media_follow - module: - - link - - typed_link -id: paragraph.oe_social_media_follow.default -targetEntityType: paragraph -bundle: oe_social_media_follow -mode: default -content: - oe_bt_links_block_background: - type: options_select - weight: 1 - region: content - settings: { } - third_party_settings: { } - field_oe_social_media_links: - weight: 3 - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - type: typed_link - region: content - field_oe_social_media_see_more: - weight: 4 - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - type: link_default - region: content - field_oe_social_media_variant: - weight: 0 - settings: { } - third_party_settings: { } - type: options_select - region: content - field_oe_title: - weight: 2 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content -hidden: - created: true - status: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml deleted file mode 100644 index 8c3a67f6..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_accordion_item.default.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_accordion_item.field_oe_icon - - field.field.paragraph.oe_accordion_item.field_oe_text - - field.field.paragraph.oe_accordion_item.field_oe_text_long - - paragraphs.paragraphs_type.oe_accordion_item - module: - - text -id: paragraph.oe_accordion_item.default -targetEntityType: paragraph -bundle: oe_accordion_item -mode: default -content: - field_oe_text: - weight: 0 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content - field_oe_text_long: - weight: 1 - label: above - settings: { } - third_party_settings: { } - type: text_default - region: content -hidden: - field_oe_icon: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml deleted file mode 100644 index 2e3b81d7..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_description_list.default.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_description_list.oe_bt_orientation - - field.field.paragraph.oe_description_list.field_oe_description_list_items - - field.field.paragraph.oe_description_list.field_oe_title - - paragraphs.paragraphs_type.oe_description_list - module: - - description_list_field -id: paragraph.oe_description_list.default -targetEntityType: paragraph -bundle: oe_description_list -mode: default -content: - field_oe_description_list_items: - weight: 1 - label: hidden - settings: { } - third_party_settings: { } - type: description_list_formatter - region: content - field_oe_title: - weight: 0 - label: hidden - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: - oe_bt_orientation: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml deleted file mode 100644 index e9dd9cf6..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_facts_figures.default.yml +++ /dev/null @@ -1,48 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_facts_figures.field_oe_link - - field.field.paragraph.oe_facts_figures.field_oe_paragraphs - - field.field.paragraph.oe_facts_figures.field_oe_title - - field.field.paragraph.oe_facts_figures.oe_bt_n_columns - - paragraphs.paragraphs_type.oe_facts_figures - module: - - entity_reference_revisions - - link -id: paragraph.oe_facts_figures.default -targetEntityType: paragraph -bundle: oe_facts_figures -mode: default -content: - field_oe_link: - weight: 2 - label: above - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_oe_paragraphs: - weight: 1 - label: above - settings: - view_mode: default - link: '' - third_party_settings: { } - type: entity_reference_revisions_entity_view - region: content - field_oe_title: - weight: 0 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: - oe_bt_n_columns: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml deleted file mode 100644 index 0d927d07..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_links_block.default.yml +++ /dev/null @@ -1,39 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_links_block.field_oe_links - - field.field.paragraph.oe_links_block.field_oe_links_block_background - - field.field.paragraph.oe_links_block.field_oe_links_block_orientation - - field.field.paragraph.oe_links_block.field_oe_text - - paragraphs.paragraphs_type.oe_links_block - module: - - link -id: paragraph.oe_links_block.default -targetEntityType: paragraph -bundle: oe_links_block -mode: default -content: - field_oe_links: - weight: 1 - label: above - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_oe_text: - weight: 0 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: - field_oe_links_block_background: true - field_oe_links_block_orientation: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml deleted file mode 100644 index 8e15a231..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/core.entity_view_display.paragraph.oe_social_media_follow.default.yml +++ /dev/null @@ -1,53 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_links - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_see_more - - field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant - - field.field.paragraph.oe_social_media_follow.field_oe_title - - paragraphs.paragraphs_type.oe_social_media_follow - module: - - link - - typed_link -id: paragraph.oe_social_media_follow.default -targetEntityType: paragraph -bundle: oe_social_media_follow -mode: default -content: - field_oe_social_media_links: - weight: 1 - label: hidden - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: typed_link - region: content - field_oe_social_media_see_more: - weight: 2 - label: hidden - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_oe_title: - weight: 0 - label: hidden - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: - oe_bt_links_block_background: true - field_oe_social_media_variant: true diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml deleted file mode 100755 index ecf09e79..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/config/overrides/field.field.paragraph.oe_social_media_follow.field_oe_social_media_variant.yml +++ /dev/null @@ -1,22 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.paragraph.field_oe_social_media_variant - - paragraphs.paragraphs_type.oe_social_media_follow - module: - - options -id: paragraph.oe_social_media_follow.field_oe_social_media_variant -field_name: field_oe_social_media_variant -entity_type: paragraph -bundle: oe_social_media_follow -label: Orientation -description: '' -required: true -translatable: false -default_value: - - - value: horizontal -default_value_callback: '' -settings: { } -field_type: list_string diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install deleted file mode 100644 index c80def17..00000000 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.install +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/** - * @file - * Install and update functions for the OE Bootstrap Theme Paragraphs module. - */ - -declare(strict_types = 1); - -use Drupal\oe_bootstrap_theme\ConfigImporter; - -/** - * Implements hook_install(). - * - * Customise fields for bootstrap theme paragraphs. - */ -function oe_whitelabel_legacy_paragraphs_test_install($is_syncing): void { - // If we are installing from config, we bail out. - if ($is_syncing) { - return; - } - - $configs = [ - 'core.entity_form_display.paragraph.oe_links_block.default', - 'core.entity_form_display.paragraph.oe_social_media_follow.default', - 'core.entity_view_display.paragraph.oe_links_block.default', - 'core.entity_view_display.paragraph.oe_social_media_follow.default', - 'core.entity_form_display.paragraph.oe_description_list.default', - 'core.entity_view_display.paragraph.oe_description_list.default', - 'core.entity_form_display.paragraph.oe_accordion_item.default', - 'core.entity_view_display.paragraph.oe_accordion_item.default', - 'core.entity_form_display.paragraph.oe_facts_figures.default', - 'core.entity_view_display.paragraph.oe_facts_figures.default', - 'core.entity_form_display.paragraph.oe_list_item_block.default', - 'core.entity_form_display.paragraph.oe_list_item_block.highlight', - 'core.entity_form_display.paragraph.oe_list_item.default', - ]; - - ConfigImporter::importMultiple('oe_whitelabel_legacy_paragraphs_test', '/config/overrides/', $configs); -} -- GitLab From 55e080f42b0b30983f6b823f850008f0cfb0c4fd Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 13:00:54 +0100 Subject: [PATCH 05/19] OEL-1281: Remove config_devel entries in test module. --- .../oe_whitelabel_legacy_paragraphs_test.info.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml index 8cf1909b..8debda97 100644 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml @@ -10,14 +10,3 @@ dependencies: - oe_content:oe_content_timeline_field - drupal:description_list_field - oe_paragraphs:oe_paragraphs_description_list -config_devel: - install: - - field.field.paragraph.oe_links_block.oe_bt_links_block_background - - field.field.paragraph.oe_links_block.oe_bt_links_block_orientation - - field.field.paragraph.oe_social_media_follow.oe_bt_links_block_background - - field.field.paragraph.oe_facts_figures.oe_bt_n_columns - - field.storage.paragraph.oe_bt_links_block_orientation - - field.storage.paragraph.oe_bt_links_block_background - - field.field.paragraph.oe_description_list.oe_bt_orientation - - field.storage.paragraph.oe_bt_orientation - - field.storage.paragraph.oe_bt_n_columns -- GitLab From d7fa5d6f1bd3de324b2bbf42290cc4036f44986d Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 13:01:22 +0100 Subject: [PATCH 06/19] OEL-1281: Clean up and reorder dependencies for test module. --- .../oe_whitelabel_legacy_paragraphs_test.info.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml index 8debda97..4cb09829 100644 --- a/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml +++ b/modules/oe_whitelabel_paragraphs/tests/modules/oe_whitelabel_legacy_paragraphs_test/oe_whitelabel_legacy_paragraphs_test.info.yml @@ -4,9 +4,6 @@ description: Provides legacy configuration as in oe_bootstrap_theme_paragraphs. package: Testing hidden: true dependencies: - - oe_paragraphs:oe_paragraphs - - oe_bootstrap_theme:oe_bootstrap_theme_helper - - oe_paragraphs:oe_paragraphs_timeline - - oe_content:oe_content_timeline_field - drupal:description_list_field + - oe_paragraphs:oe_paragraphs - oe_paragraphs:oe_paragraphs_description_list -- GitLab From 12c59b91501fb2a659d24fbf82d10500dbe5a3d9 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 13:02:00 +0100 Subject: [PATCH 07/19] OEL-1281: Document assertion strategy in InstallTest. --- .../tests/src/Functional/InstallTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index 2da2d611..03bb0bdd 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -180,6 +180,8 @@ class InstallTest extends BrowserTestBase { ], ]; + // Produce reports instead of many individual assertions. This is less + // simple in code, but produces more useful output on test failure. $actual_updated = []; $actual_deleted = []; foreach ($ids as $name => $id) { @@ -187,8 +189,11 @@ class InstallTest extends BrowserTestBase { self::assertNotNull($updated_paragraph); foreach ($expected_created[$name] as $field_name => $value) { if (!$updated_paragraph->hasField($field_name)) { + // The expected field was not created. + // Omit this entry in $actual_updated, to cause a fail below. continue; } + // The expected field was created, but the value might be wrong. $actual_updated[$name][$field_name] = $updated_paragraph->get($field_name)->value; } foreach ($expected_deleted[$name] as $field_name => $deleted) { @@ -196,6 +201,7 @@ class InstallTest extends BrowserTestBase { } } + // Compare the reports to the expected values. self::assertSame($expected_created, $actual_updated); self::assertSame($expected_deleted, $actual_deleted); } -- GitLab From 474712b1eb0ef5043d30d721c755c6f140ed198d Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Mon, 21 Mar 2022 13:16:08 +0100 Subject: [PATCH 08/19] OEL-1281: Use local variable instead of inline evaluation in foreach. --- .../oe_whitelabel_paragraphs.install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 5559c9cc..77b4e15f 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -147,8 +147,13 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names // Revision not found - this is unexpected, but survivable. continue; } + $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()] ?? []; + if (!$field_names_map) { + // No field names to migrate - this is unexpected. + continue; + } $modified = FALSE; - foreach ($field_names_by_bundle[$paragraph_revision->bundle()] ?? [] as $dest_field_name => $source_field_name) { + foreach ($field_names_map as $dest_field_name => $source_field_name) { if ($paragraph_revision->get($source_field_name)->isEmpty()) { // Source field has no data. continue; -- GitLab From 657963c781333cebc1bab1e0dc3765efc48b3044 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 09:45:12 +0200 Subject: [PATCH 09/19] OEL-1281: Use static mapping for legacy fields map, change defensive code. This is simpler, and prevents the operation to run on unknown paragraph types. --- .../oe_whitelabel_paragraphs.install | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 77b4e15f..442579b4 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -87,33 +87,37 @@ function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { $entity_field_manager = \Drupal::service('entity_field.manager'); $fields_map = $entity_field_manager->getFieldMap()['paragraph'] ?? []; - $field_names_map = [ - 'oe_w_links_block_background' => 'oe_bt_links_block_background', - 'oe_w_links_block_orientation' => 'oe_bt_links_block_orientation', - 'oe_w_n_columns' => 'oe_bt_n_columns', - 'oe_w_orientation' => 'oe_bt_orientation', + $field_names_by_bundle = [ + 'oe_description_list' => [ + 'oe_w_orientation' => 'oe_bt_orientation', + ], + 'oe_facts_figures' => [ + 'oe_w_n_columns' => 'oe_bt_n_columns', + ], + 'oe_links_block' => [ + 'oe_w_links_block_background' => 'oe_bt_links_block_background', + 'oe_w_links_block_orientation' => 'oe_bt_links_block_orientation', + ], + 'oe_social_media_follow' => [ + 'oe_w_links_block_background' => 'oe_bt_links_block_background', + ], ]; - /** - * @var string[][] $field_names_by_bundle - * Legacy field names, indexed by paragraph type and destination field name. - */ - $field_names_by_bundle = []; - foreach ($field_names_map as $dest_field_name => $source_field_name) { - if (!isset($fields_map[$source_field_name])) { - // No field to migrate from. - continue; - } - if (!isset($fields_map[$dest_field_name])) { - // No target field to migrate to - this is unexpected. - continue; - } - // Find bundles where both source and destination fields exist. - foreach (array_intersect_key( - $fields_map[$dest_field_name]['bundles'], - $fields_map[$source_field_name]['bundles'], - ) as $bundle) { - $field_names_by_bundle[$bundle][$dest_field_name] = $source_field_name; + foreach ($field_names_by_bundle as $bundle => $field_names) { + foreach ($field_names as $dest_field_name => $source_field_name) { + if (!isset($fields_map[$source_field_name]['bundles'][$bundle])) { + // The legacy field does not exist. + // Perhaps the field or the paragraph type were removed manually. + unset($field_names_by_bundle[$bundle][$dest_field_name]); + continue; + } + if (!isset($fields_map[$dest_field_name]['bundles'][$bundle])) { + // A destination field is missing, that should have been created + // earlier. This could happen if a paragraph type was removed manually, + // but in that case the install should have already failed earlier. + // Either way, this case is not supported. + throw new \RuntimeException("Destination field 'paragraph.$bundle.$dest_field_name' was not properly created."); + } } } -- GitLab From 1b05cef2b63b15a13ce23442495f72a3c816af12 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 09:48:26 +0200 Subject: [PATCH 10/19] OEL-1281: Drop useless comment lines. --- .../oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 442579b4..4d221d23 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -131,8 +131,6 @@ function _oe_whitelabel_paragraphs_install_get_legacy_fields_map(): array { * hook_update_N(). Unfortunately, hook_install() does not support batch * processes. * - * See https://atendesigngroup.com/articles/programmatically-copy-field-data-drupal-8. - * * @param string[][] $field_names_by_bundle * Legacy field names, indexed by paragraph type and destination field name. */ @@ -187,7 +185,6 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names * * @param string[][] $field_names_by_bundle * Legacy field names, indexed by paragraph type and destination field name. - * (The destination field name is not relevant for this function.) */ function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names_by_bundle): void { foreach ($field_names_by_bundle as $bundle => $field_names) { -- GitLab From 351d80d122a369774a7807abae634f09bc933c23 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 09:52:26 +0200 Subject: [PATCH 11/19] OEL-1281: Drop defensive code for impossible cases. Use `@var` doc to document that variable won't be NULL. --- .../oe_whitelabel_paragraphs.install | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 4d221d23..e7448aaf 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -144,16 +144,10 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names $paragraph_ids = $query->execute(); foreach ($paragraph_ids as $revision_id => $paragraph_id) { + // Revision can't be NULL. + /** @var \Drupal\paragraphs\ParagraphInterface $paragraph_revision */ $paragraph_revision = $paragraphs_storage->loadRevision($revision_id); - if (!$paragraph_revision) { - // Revision not found - this is unexpected, but survivable. - continue; - } - $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()] ?? []; - if (!$field_names_map) { - // No field names to migrate - this is unexpected. - continue; - } + $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()]; $modified = FALSE; foreach ($field_names_map as $dest_field_name => $source_field_name) { if ($paragraph_revision->get($source_field_name)->isEmpty()) { -- GitLab From ca450953dd74c097bb020e55d1a422f48096f15c Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 21:32:25 +0200 Subject: [PATCH 12/19] OEL-1042: Rename $definition -> $field_config. --- .../oe_whitelabel_paragraphs.install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index e7448aaf..81c9e726 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -183,12 +183,12 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names_by_bundle): void { foreach ($field_names_by_bundle as $bundle => $field_names) { foreach ($field_names as $field_name) { - $definition = FieldConfig::loadByName('paragraph', $bundle, $field_name); - if ($definition === NULL) { + $field_config = FieldConfig::loadByName('paragraph', $bundle, $field_name); + if ($field_config === NULL) { // Field no longer exists. This is unexpected, but can be ignored. continue; } - $definition->delete(); + $field_config->delete(); } } } -- GitLab From 5526a4c197bf83ec9a2dd7abbb9d7a598207421e Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 10:32:06 +0200 Subject: [PATCH 13/19] OEL-1281: Throw RuntimeException in unexpected scenarios. --- .../oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 81c9e726..ef56c14e 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -185,8 +185,7 @@ function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names foreach ($field_names as $field_name) { $field_config = FieldConfig::loadByName('paragraph', $bundle, $field_name); if ($field_config === NULL) { - // Field no longer exists. This is unexpected, but can be ignored. - continue; + throw new \RuntimeException("Legacy field 'paragraph.$bundle.$field_name' not found."); } $field_config->delete(); } -- GitLab From 46f29b35da4799ddf3ad40148bfd9e5978833df2 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 12:02:28 +0200 Subject: [PATCH 14/19] OEL-1281: Rename variables $field_name(s) -> $legacy_field_name(s). --- .../oe_whitelabel_paragraphs.install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index ef56c14e..0479caf5 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -181,11 +181,11 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names * Legacy field names, indexed by paragraph type and destination field name. */ function _oe_whitelabel_paragraphs_install_drop_legacy_fields(array $field_names_by_bundle): void { - foreach ($field_names_by_bundle as $bundle => $field_names) { - foreach ($field_names as $field_name) { - $field_config = FieldConfig::loadByName('paragraph', $bundle, $field_name); + foreach ($field_names_by_bundle as $bundle => $legacy_field_names) { + foreach ($legacy_field_names as $legacy_field_name) { + $field_config = FieldConfig::loadByName('paragraph', $bundle, $legacy_field_name); if ($field_config === NULL) { - throw new \RuntimeException("Legacy field 'paragraph.$bundle.$field_name' not found."); + throw new \RuntimeException("Legacy field 'paragraph.$bundle.$legacy_field_name' not found."); } $field_config->delete(); } -- GitLab From 95b6e687fa2994f701c7207133f2ea4a1fd11b95 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 10:33:07 +0200 Subject: [PATCH 15/19] OEL-1281: Don't use injected services in tests, remove unnecessary assertions. --- .../tests/src/Functional/InstallTest.php | 51 +++---------------- 1 file changed, 7 insertions(+), 44 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index 03bb0bdd..dc62a9d5 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -14,20 +14,6 @@ use Drupal\Tests\BrowserTestBase; */ class InstallTest extends BrowserTestBase { - /** - * Module handler to ensure installed modules. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Module installer. - * - * @var \Drupal\Core\Extension\ModuleInstallerInterface - */ - protected $moduleInstaller; - /** * {@inheritdoc} */ @@ -41,30 +27,6 @@ class InstallTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; - /** - * {@inheritdoc} - */ - protected function setUp(): void { - parent::setUp(); - $this->initServices(); - } - - /** - * Reloads services used by this test. - */ - protected function reloadServices(): void { - $this->rebuildContainer(); - $this->initServices(); - } - - /** - * Initializes services. - */ - protected function initServices(): void { - $this->moduleHandler = $this->container->get('module_handler'); - $this->moduleInstaller = $this->container->get('module_installer'); - } - /** * Test installation with legacy fields and data present. */ @@ -141,12 +103,13 @@ class InstallTest extends BrowserTestBase { $ids[$name] = $paragraph->id(); } - self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_legacy_paragraphs_test')); - self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); - self::assertTrue($this->moduleInstaller->install(['oe_whitelabel_paragraphs'])); - self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); - $this->reloadServices(); - self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs')); + /** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */ + $installer = \Drupal::service('module_installer'); + $installer->install(['oe_whitelabel_paragraphs']); + + $this->assertTrue( + \Drupal::moduleHandler()->moduleExists('oe_whitelabel_paragraphs'), + "Module 'oe_whitelabel_paragraphs was successfully installed."); $expected_created = [ 'oe_description_list' => [ -- GitLab From 1d8b417f783ed53f787e3db1371463a8f2670328 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 10:33:19 +0200 Subject: [PATCH 16/19] OEL-1281: Use $this->assert*() instead of self::assert*(), as in core. --- .../tests/src/Functional/InstallTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index dc62a9d5..a2347c09 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -149,7 +149,7 @@ class InstallTest extends BrowserTestBase { $actual_deleted = []; foreach ($ids as $name => $id) { $updated_paragraph = Paragraph::load($id); - self::assertNotNull($updated_paragraph); + $this->assertNotNull($updated_paragraph); foreach ($expected_created[$name] as $field_name => $value) { if (!$updated_paragraph->hasField($field_name)) { // The expected field was not created. @@ -165,8 +165,8 @@ class InstallTest extends BrowserTestBase { } // Compare the reports to the expected values. - self::assertSame($expected_created, $actual_updated); - self::assertSame($expected_deleted, $actual_deleted); + $this->assertSame($expected_created, $actual_updated); + $this->assertSame($expected_deleted, $actual_deleted); } } -- GitLab From f97f806d90791313320420fdc6dfb77ba7aec899 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 10:50:08 +0200 Subject: [PATCH 17/19] OEL-1281: Test one of the paragraphs with an older revision. --- .../tests/src/Functional/InstallTest.php | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index a2347c09..c67eeeac 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -96,11 +96,20 @@ class InstallTest extends BrowserTestBase { ], ]; - $ids = []; + $revision_ids = []; foreach ($paragraphs_data as $name => $paragraph_data) { $paragraph = Paragraph::create($paragraph_data); $paragraph->save(); - $ids[$name] = $paragraph->id(); + $revision_ids[$name] = $paragraph->getRevisionId(); + if ($name !== 'oe_links_block') { + // Don't create a revision for most of the paragraphs. + continue; + } + // Make this paragraph a revision. + $paragraph->setNewRevision(); + $paragraph->oe_bt_links_block_orientation = 'horizontal'; + $paragraph->save(); + $revision_ids[$name . ':modified'] = $paragraph->getRevisionId(); } /** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */ @@ -122,6 +131,10 @@ class InstallTest extends BrowserTestBase { 'oe_w_links_block_orientation' => 'vertical', 'oe_w_links_block_background' => 'gray', ], + 'oe_links_block:modified' => [ + 'oe_w_links_block_orientation' => 'horizontal', + 'oe_w_links_block_background' => 'gray', + ], 'oe_social_media_follow' => [ 'oe_w_links_block_background' => 'gray', ], @@ -138,29 +151,35 @@ class InstallTest extends BrowserTestBase { 'oe_bt_links_block_orientation' => TRUE, 'oe_bt_links_block_background' => TRUE, ], + 'oe_links_block:modified' => [ + 'oe_bt_links_block_orientation' => TRUE, + 'oe_bt_links_block_background' => TRUE, + ], 'oe_social_media_follow' => [ 'oe_bt_links_block_background' => TRUE, ], ]; + $storage = \Drupal::entityTypeManager()->getStorage('paragraph'); + // Produce reports instead of many individual assertions. This is less // simple in code, but produces more useful output on test failure. $actual_updated = []; $actual_deleted = []; - foreach ($ids as $name => $id) { - $updated_paragraph = Paragraph::load($id); - $this->assertNotNull($updated_paragraph); + foreach ($revision_ids as $name => $revision_id) { + $updated_revision = $storage->loadRevision($revision_id); + $this->assertNotNull($updated_revision); foreach ($expected_created[$name] as $field_name => $value) { - if (!$updated_paragraph->hasField($field_name)) { + if (!$updated_revision->hasField($field_name)) { // The expected field was not created. // Omit this entry in $actual_updated, to cause a fail below. continue; } // The expected field was created, but the value might be wrong. - $actual_updated[$name][$field_name] = $updated_paragraph->get($field_name)->value; + $actual_updated[$name][$field_name] = $updated_revision->get($field_name)->value; } foreach ($expected_deleted[$name] as $field_name => $deleted) { - $actual_deleted[$name][$field_name] = !$updated_paragraph->hasField($field_name); + $actual_deleted[$name][$field_name] = !$updated_revision->hasField($field_name); } } -- GitLab From 0636d87b1c503b3f6563a0d41df7130dc8af4043 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 11:59:52 +0200 Subject: [PATCH 18/19] OEL-1281: Test config deletion explicitly. --- .../tests/src/Functional/InstallTest.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index c67eeeac..84237851 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -4,6 +4,8 @@ declare(strict_types = 1); namespace Drupal\Tests\oe_whitelabel_paragraphs\Functional; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\paragraphs\Entity\Paragraph; use Drupal\Tests\BrowserTestBase; @@ -112,6 +114,28 @@ class InstallTest extends BrowserTestBase { $revision_ids[$name . ':modified'] = $paragraph->getRevisionId(); } + $legacy_field_config_ids = [ + 'paragraph.oe_description_list.oe_bt_orientation', + 'paragraph.oe_facts_figures.oe_bt_n_columns', + 'paragraph.oe_links_block.oe_bt_links_block_background', + 'paragraph.oe_links_block.oe_bt_links_block_orientation', + 'paragraph.oe_social_media_follow.oe_bt_links_block_background', + ]; + $legacy_field_storage_ids = [ + 'paragraph.oe_bt_links_block_background', + 'paragraph.oe_bt_links_block_orientation', + 'paragraph.oe_bt_n_columns', + 'paragraph.oe_bt_orientation', + ]; + $this->assertEqualsCanonicalizing( + $legacy_field_config_ids, + \array_keys(FieldConfig::loadMultiple($legacy_field_config_ids)), + ); + $this->assertEqualsCanonicalizing( + $legacy_field_storage_ids, + \array_keys(FieldStorageConfig::loadMultiple($legacy_field_storage_ids)), + ); + /** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */ $installer = \Drupal::service('module_installer'); $installer->install(['oe_whitelabel_paragraphs']); @@ -120,6 +144,9 @@ class InstallTest extends BrowserTestBase { \Drupal::moduleHandler()->moduleExists('oe_whitelabel_paragraphs'), "Module 'oe_whitelabel_paragraphs was successfully installed."); + $this->assertEmpty(FieldConfig::loadMultiple($legacy_field_config_ids)); + $this->assertEmpty(FieldStorageConfig::loadMultiple($legacy_field_storage_ids)); + $expected_created = [ 'oe_description_list' => [ 'oe_w_orientation' => 'horizontal', -- GitLab From e9cbd0ee6453ecf07df8bf50c95ccc4c9312c3f5 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Wed, 30 Mar 2022 19:18:28 +0200 Subject: [PATCH 19/19] OEL-1281: Don't use fully-qualified name for global functions. --- .../tests/src/Functional/InstallTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php index 84237851..e6a20318 100644 --- a/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php +++ b/modules/oe_whitelabel_paragraphs/tests/src/Functional/InstallTest.php @@ -129,11 +129,11 @@ class InstallTest extends BrowserTestBase { ]; $this->assertEqualsCanonicalizing( $legacy_field_config_ids, - \array_keys(FieldConfig::loadMultiple($legacy_field_config_ids)), + array_keys(FieldConfig::loadMultiple($legacy_field_config_ids)), ); $this->assertEqualsCanonicalizing( $legacy_field_storage_ids, - \array_keys(FieldStorageConfig::loadMultiple($legacy_field_storage_ids)), + array_keys(FieldStorageConfig::loadMultiple($legacy_field_storage_ids)), ); /** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */ -- GitLab