From 9e009ed46c277ac29e8d5714aef3b11d3cf113a6 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 11 Jan 2021 20:31:42 +0000 Subject: [PATCH] Issue #2565931 by quietone, jofitz, shaktik, sokru, mikeryan, clemens.tolboom, kapilkumar0324, anushrikumari, wturrell, benjifisher, mikelutz: Handle long comment bundle names (cherry picked from commit 5fb97954e804f6942b8a3f631fd29497457c942d) --- .../comment/migrations/d6_comment_type.yml | 6 + .../comment/migrations/d7_comment_type.yml | 6 + .../Migrate/d6/MigrateCommentTypeTest.php | 1 + .../Migrate/d7/MigrateCommentTypeTest.php | 1 + .../d7_field_formatter_settings.yml | 16 ++- .../field/migrations/d7_field_instance.yml | 7 +- .../d7_field_instance_widget_settings.yml | 16 ++- .../Plugin/migrate/process/d7/FieldBundle.php | 113 ++++++++++++++++++ .../d6/MigrateFieldFormatterSettingsTest.php | 9 +- .../Migrate/d6/MigrateFieldInstanceTest.php | 8 +- .../d6/MigrateFieldWidgetSettingsTest.php | 9 +- .../d7/MigrateFieldFormatterSettingsTest.php | 3 + .../Migrate/d7/MigrateFieldInstanceTest.php | 1 + ...MigrateFieldInstanceWidgetSettingsTest.php | 3 + .../migrate_drupal/tests/fixtures/drupal6.php | 16 +++ .../migrate_drupal/tests/fixtures/drupal7.php | 33 +++++ .../src/Kernel/d7/FieldDiscoveryTest.php | 6 +- .../src/Functional/d6/NodeClassicTest.php | 2 +- .../tests/src/Functional/d6/Upgrade6Test.php | 16 +-- .../tests/src/Functional/d7/Upgrade7Test.php | 12 +- .../src/Kernel/Migrate/d6/MigrateNodeTest.php | 2 +- .../Kernel/Migrate/d6/MigrateNodeTypeTest.php | 4 + .../Migrate/d7/MigrateNodeCompleteTest.php | 2 +- .../src/Kernel/Migrate/d7/MigrateNodeTest.php | 2 +- .../Kernel/Migrate/d7/MigrateNodeTypeTest.php | 3 + 25 files changed, 263 insertions(+), 34 deletions(-) create mode 100644 core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php diff --git a/core/modules/comment/migrations/d6_comment_type.yml b/core/modules/comment/migrations/d6_comment_type.yml index 582c827f1f1d..55b033d29419 100644 --- a/core/modules/comment/migrations/d6_comment_type.yml +++ b/core/modules/comment/migrations/d6_comment_type.yml @@ -24,6 +24,12 @@ process: # want to reuse if it exists. map: comment_node_forum: comment_forum + - + plugin: make_unique_entity_field + entity_type: comment_type + field: id + length: 30 + migrated: true label: plugin: concat source: diff --git a/core/modules/comment/migrations/d7_comment_type.yml b/core/modules/comment/migrations/d7_comment_type.yml index ad34c4f48a84..4128eda6b9b4 100644 --- a/core/modules/comment/migrations/d7_comment_type.yml +++ b/core/modules/comment/migrations/d7_comment_type.yml @@ -24,6 +24,12 @@ process: # want to reuse if it exists. map: comment_node_forum: comment_forum + - + plugin: make_unique_entity_field + entity_type: comment_type + field: id + length: 30 + migrated: true label: plugin: concat source: diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php index 58dc428d8962..d6cea720b13f 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php @@ -58,6 +58,7 @@ public function testMigration() { $this->assertEntity('comment_node_test_page', 'Migrate test page comment'); $this->assertEntity('comment_node_test_planet', 'Migrate test planet comment'); $this->assertEntity('comment_node_test_story', 'Migrate test story comment'); + $this->assertEntity('comment_node_a_thirty_two_char', 'Test long name comment'); } } diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php index 8345cef94b33..0f32c1950f94 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php @@ -64,6 +64,7 @@ public function testMigration() { $this->assertEntity('comment_forum', 'Forum topic comment'); $this->assertEntity('comment_node_page', 'Basic page comment'); $this->assertEntity('comment_node_test_content_type', 'Test content type comment'); + $this->assertEntity('comment_node_a_thirty_two_char', 'Test long name comment'); } } diff --git a/core/modules/field/migrations/d7_field_formatter_settings.yml b/core/modules/field/migrations/d7_field_formatter_settings.yml index f41575fdc874..aba87892bcce 100644 --- a/core/modules/field/migrations/d7_field_formatter_settings.yml +++ b/core/modules/field/migrations/d7_field_formatter_settings.yml @@ -31,11 +31,17 @@ process: # that might already exist before this migration is run. See # d7_comment_type.yml or more information. bundle: - plugin: static_map - source: bundle - bypass: true - map: - comment_node_forum: comment_forum + - + plugin: migration_lookup + migration: d7_field_instance + source: + - entity_type + - bundle + - field_name + - + plugin: extract + index: + - 1 view_mode: - plugin: migration_lookup diff --git a/core/modules/field/migrations/d7_field_instance.yml b/core/modules/field/migrations/d7_field_instance.yml index 6edf3047d349..0fefd047070e 100644 --- a/core/modules/field/migrations/d7_field_instance.yml +++ b/core/modules/field/migrations/d7_field_instance.yml @@ -19,12 +19,17 @@ process: # The bundle needs to be statically mapped in order to support comment types # that might already exist before this migration is run. See # d7_comment_type.yml for more information. - bundle: + bundle_mapped: plugin: static_map source: bundle bypass: true map: comment_node_forum: comment_forum + bundle: + plugin: field_bundle + source: + - entity_type + - '@bundle_mapped' label: label description: description required: required diff --git a/core/modules/field/migrations/d7_field_instance_widget_settings.yml b/core/modules/field/migrations/d7_field_instance_widget_settings.yml index eaa7831d69fa..55df7cb1c70d 100644 --- a/core/modules/field/migrations/d7_field_instance_widget_settings.yml +++ b/core/modules/field/migrations/d7_field_instance_widget_settings.yml @@ -31,11 +31,17 @@ process: # that might already exist before this migration is run. See # d7_comment_type.yml for more information. bundle: - plugin: static_map - source: bundle - bypass: true - map: - comment_node_forum: comment_forum + - + plugin: migration_lookup + migration: d7_field_instance + source: + - entity_type + - bundle + - field_name + - + plugin: extract + index: + - 1 form_mode: 'constants/form_mode' field_name: field_name entity_type: entity_type diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php new file mode 100644 index 000000000000..e4424ac6b6a8 --- /dev/null +++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldBundle.php @@ -0,0 +1,113 @@ +<?php + +namespace Drupal\field\Plugin\migrate\process\d7; + +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\MigrateLookupInterface; +use Drupal\migrate\Plugin\MigrationInterface; +use Drupal\migrate\ProcessPluginBase; +use Drupal\migrate\Row; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Determines the bundle for a field. + * + * The field bundle process plugin is used to get the destination bundle name + * for a field. This is necessary because the bundle names used for comments in + * legacy versions of Drupal are no longer used. + * + * Available configuration keys: + * - source: The input value - must be an array. + * + * Examples: + * + * @code + * process: + * bundle: + * plugin: field_bundle + * source + * - entity_type + * - bundle + * @endcode + * + * If 'bundle' is 'article' and 'entity_type' is node then 'article' is + * returned. + * + * @code + * process: + * bundle: + * plugin: field_bundle + * source + * - entity_type + * - bundle + * @endcode + * + * If 'bundle' is 'comment_node_a_thirty_two_character_name' and 'entity_type' + * is blog then a lookup is performed on the comment type migration so that the + * migrated bundle name for 'comment_node_a_thirty_two_character_name' is + * returned. That name will be truncated to 'comment_node_a_thirty_two_char'. + * + * @see core/modules/comment/migrations/d7_comment_type.yml + * @see core/modules/field/migrations/d7_field_instance.yml + * + * * @MigrateProcessPlugin( + * id = "field_bundle" + * ) + */ +class FieldBundle extends ProcessPluginBase implements ContainerFactoryPluginInterface { + + /** + * The migrate lookup service. + * + * @var \Drupal\migrate\MigrateLookupInterface + */ + protected $migrateLookup; + + /** + * Constructs a ProcessField plugin. + * + * @param array $configuration + * The plugin configuration. + * @param string $plugin_id + * The plugin ID. + * @param mixed $plugin_definition + * The plugin definition. + * @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup + * The migrate lookup service. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateLookupInterface $migrate_lookup) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->migrateLookup = $migrate_lookup; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('migrate.lookup') + ); + } + + /** + * {@inheritdoc} + */ + public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { + [$entity_type, $bundle] = $value; + $lookup_result = NULL; + // For comment entity types get the destination bundle from the + // d7_comment_type migration, if it exists. + if ($entity_type === 'comment' && $bundle != 'comment_forum') { + $value = preg_replace('/comment_node_/', NULL, $bundle); + $migration = 'd7_comment_type'; + $lookup_result = $this->migrateLookup->lookup($migration, [$value]); + $lookup_result = empty($lookup_result) ? NULL : reset($lookup_result[0]); + } + return $lookup_result ? $lookup_result : $bundle; + } + +} diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php index d93d79b49a76..61d0d6e96383 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldFormatterSettingsTest.php @@ -15,13 +15,15 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - protected static $modules = ['menu_ui', 'node']; + protected static $modules = ['comment', 'menu_ui', 'node']; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); + $this->installConfig(['comment']); + $this->executeMigration('d6_comment_type'); $this->migrateFields(); } @@ -225,6 +227,11 @@ public function testEntityDisplaySettings() { $this->assertSame('entity_reference_label', $component['type']); // The default user reference formatter links to the referenced user. $this->assertTrue($component['settings']['link']); + + $display = EntityViewDisplay::load('comment.comment_node_a_thirty_two_char.default'); + $component = $display->getComponent('comment_body'); + $this->assertIsArray($component); + $this->assertSame('text_default', $component['type']); } } diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceTest.php index fd33e56b2445..afc8bd34dbe9 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceTest.php @@ -17,13 +17,15 @@ class MigrateFieldInstanceTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - protected static $modules = ['menu_ui', 'node']; + protected static $modules = ['comment', 'menu_ui', 'node']; /** * Tests migration of file variables to file.settings.yml. */ public function testFieldInstanceMigration() { $this->migrateFields(); + $this->installConfig(['comment']); + $this->executeMigration('d6_comment_type'); $entity = Node::create(['type' => 'story']); // Test a text field. @@ -166,6 +168,10 @@ public function testFieldInstanceMigration() { $field = FieldConfig::load('node.employee.field_sync'); $this->assertInstanceOf(FieldConfig::class, $field); $this->assertFalse($field->isTranslatable()); + + // Test a comment with a long name. + $field = FieldConfig::load('comment.comment_node_a_thirty_two_char.comment_body'); + $this->assertInstanceOf(FieldConfig::class, $field); } /** diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php index 1317fa16c418..318df531a9f2 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php @@ -15,13 +15,15 @@ class MigrateFieldWidgetSettingsTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - protected static $modules = ['menu_ui']; + protected static $modules = ['comment', 'menu_ui']; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); + $this->installConfig(['comment']); + $this->executeMigration('d6_comment_type'); $this->migrateFields(); } @@ -124,6 +126,11 @@ public function testWidgetSettings() { ->getComponent('field_commander'); $this->assertIsArray($component); $this->assertSame('options_select', $component['type']); + + $component = $display_repository->getFormDisplay('comment', 'comment_node_a_thirty_two_char', 'default') + ->getComponent('comment_body'); + $this->assertIsArray($component); + $this->assertSame('text_textarea', $component['type']); } } diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php index 6462bd98d9e0..18a2893916eb 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php @@ -106,6 +106,9 @@ public function testMigration() { $this->assertComponent('comment.comment_node_test_content_type.default', 'comment_body', 'text_default', 'hidden', 0); $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number_integer', 'above', 1); + $this->assertEntity('comment.comment_node_a_thirty_two_char.default'); + $this->assertComponent('comment.comment_node_a_thirty_two_char.default', 'comment_body', 'text_default', 'hidden', 0); + $this->assertEntity('node.article.default'); $this->assertComponent('node.article.default', 'body', 'text_default', 'hidden', 0); $this->assertComponent('node.article.default', 'field_tags', 'entity_reference_label', 'above', 10); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php index e1843664038a..56fe00aea590 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php @@ -131,6 +131,7 @@ public function testFieldInstances() { $this->assertEntity('node.test_content_type.field_term_reference', 'Term Reference', 'entity_reference', FALSE, FALSE); $this->assertEntity('node.test_content_type.field_text', 'Text', 'string', FALSE, FALSE); $this->assertEntity('comment.comment_node_test_content_type.field_integer', 'Integer', 'integer', FALSE, TRUE); + $this->assertEntity('comment.comment_node_a_thirty_two_char.comment_body', 'Comment', 'text_long', TRUE, FALSE); $this->assertEntity('user.user.field_file', 'File', 'file', FALSE, FALSE); $this->assertLinkFields('node.test_content_type.field_link', DRUPAL_OPTIONAL); diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php index 6f97ec66b5ce..140de3e335d6 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php @@ -136,6 +136,9 @@ public function testWidgetSettings() { $this->assertComponent('comment.comment_node_test_content_type.default', 'comment_body', 'text_textarea', 0); $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number', 2); + $this->assertEntity('comment.comment_node_a_thirty_two_char.default', 'comment', 'comment_node_a_thirty_two_char'); + $this->assertComponent('comment.comment_node_a_thirty_two_char.default', 'comment_body', 'text_textarea', 0); + $this->assertEntity('taxonomy_term.test_vocabulary.default', 'taxonomy_term', 'test_vocabulary'); $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number', 2); } diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal6.php b/core/modules/migrate_drupal/tests/fixtures/drupal6.php index 5918895b6fbf..5be9fe5e5301 100644 --- a/core/modules/migrate_drupal/tests/fixtures/drupal6.php +++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php @@ -46177,6 +46177,22 @@ 'locked' => '0', 'orig_type' => 'test_story', )) +->values(array( + 'type' => 'a_thirty_two_character_type_name', + 'name' => 'Test long name', + 'module' => 'node', + 'description' => '', + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => '', +)) ->execute(); $connection->schema()->createTable('permission', array( 'fields' => array( diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal7.php b/core/modules/migrate_drupal/tests/fixtures/drupal7.php index c8b0055c5f20..413f9aa16001 100644 --- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php @@ -5339,6 +5339,24 @@ 'data' => 'a:7:{s:5:"label";s:7:"termrss";s:6:"widget";a:5:{s:6:"weight";s:2:"16";s:4:"type";s:15:"options_buttons";s:6:"module";s:7:"options";s:6:"active";i:1;s:8:"settings";a:0:{}}s:8:"settings";a:2:{s:18:"user_register_form";b:0;s:23:"entity_translation_sync";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:36:"taxonomy_term_reference_rss_category";s:6:"weight";s:2:"14";s:8:"settings";a:0:{}s:6:"module";s:8:"taxonomy";}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}', 'deleted' => '0', )) +->values(array( + 'id' => '86', + 'field_id' => '1', + 'field_name' => 'comment_body', + 'entity_type' => 'comment', + 'bundle' => 'comment_node_a_thirty_two_character_type_name', + 'data' => 'a:6:{s:5:"label";s:7:"Comment";s:8:"settings";a:2:{s:15:"text_processing";i:1;s:18:"user_register_form";b:0;}s:8:"required";b:1;s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:6:"hidden";s:4:"type";s:12:"text_default";s:6:"weight";i:0;s:8:"settings";a:0:{}s:6:"module";s:4:"text";}}s:6:"widget";a:4:{s:4:"type";s:13:"text_textarea";s:8:"settings";a:1:{s:4:"rows";i:5;}s:6:"weight";i:0;s:6:"module";s:4:"text";}s:11:"description";s:0:"";}', + 'deleted' => '0', +)) +->values(array( + 'id' => '87', + 'field_id' => '2', + 'field_name' => 'body', + 'entity_type' => 'node', + 'bundle' => 'a_thirty_two_character_type_name', + 'data' => 'a:6:{s:5:"label";s:4:"Body";s:6:"widget";a:4:{s:4:"type";s:26:"text_textarea_with_summary";s:8:"settings";a:2:{s:4:"rows";i:20;s:12:"summary_rows";i:5;}s:6:"weight";i:-4;s:6:"module";s:4:"text";}s:8:"settings";a:3:{s:15:"display_summary";b:1;s:15:"text_processing";i:1;s:18:"user_register_form";b:0;}s:7:"display";a:2:{s:7:"default";a:5:{s:5:"label";s:6:"hidden";s:4:"type";s:12:"text_default";s:8:"settings";a:0:{}s:6:"module";s:4:"text";s:6:"weight";i:0;}s:6:"teaser";a:5:{s:5:"label";s:6:"hidden";s:4:"type";s:23:"text_summary_or_trimmed";s:8:"settings";a:1:{s:11:"trim_length";i:600;}s:6:"module";s:4:"text";s:6:"weight";i:0;}}s:8:"required";b:0;s:11:"description";s:0:"";}', + 'deleted' => '0', +)) ->execute(); $connection->schema()->createTable('field_data_body', array( 'fields' => array( @@ -44745,6 +44763,21 @@ 'locked' => '0', 'disabled' => '0', 'orig_type' => 'et', +)) + ->values(array( + 'type' => 'a_thirty_two_character_type_name', + 'name' => 'Test long name', + 'base' => 'node_content', + 'module' => 'node', + 'description' => '', + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'disabled' => '0', + 'orig_type' => 'page', )) ->execute(); diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php index ccbcde606c0b..cf43412090ca 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php @@ -80,6 +80,7 @@ public function setUp(): void { 'et' => 'comment_node_et', 'forum' => 'comment_forum', 'test_content_type' => 'comment_node_test_content_type', + 'a_thirty_two_character_type_name' => 'a_thirty_two_character_type_name', ]; foreach ($node_types as $node_type => $comment_type) { NodeType::create([ @@ -97,6 +98,7 @@ public function setUp(): void { Vocabulary::create(['vid' => 'test_vocabulary'])->save(); $this->executeMigrations([ 'd7_field', + 'd7_comment_type', 'd7_taxonomy_vocabulary', 'd7_field_instance', ]); @@ -283,8 +285,8 @@ public function testGetAllFields() { $this->assertArrayHasKey('test_vocabulary', $actual_fields['taxonomy_term']); $this->assertArrayHasKey('user', $actual_fields['user']); $this->assertArrayHasKey('test_content_type', $actual_fields['node']); - $this->assertCount(7, $actual_fields['node']); - $this->assertCount(7, $actual_fields['comment']); + $this->assertCount(8, $actual_fields['node']); + $this->assertCount(8, $actual_fields['comment']); $this->assertCount(22, $actual_fields['node']['test_content_type']); foreach ($actual_fields as $entity_type_id => $bundles) { foreach ($bundles as $bundle => $fields) { diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php index a6c5e37dce2d..0271a0936845 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php @@ -106,7 +106,7 @@ public function testMigrateUpgradeExecute() { // Confirm there are only classic node migration map tables. This shows // that only the classic migration will run. $results = $this->nodeMigrateMapTableCount('6'); - $this->assertSame(13, $results['node']); + $this->assertSame(14, $results['node']); $this->assertSame(0, $results['node_complete']); } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php index 6436b282b04f..033034c3db2f 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php @@ -77,13 +77,13 @@ protected function getEntityCounts() { 'comment' => 8, // The 'standard' profile provides the 'comment' comment type, and the // migration creates 12 comment types, one per node type. - 'comment_type' => 13, + 'comment_type' => 14, 'contact_form' => 5, 'contact_message' => 0, 'configurable_language' => 5, 'editor' => 2, - 'field_config' => 99, - 'field_storage_config' => 70, + 'field_config' => 103, + 'field_storage_config' => 71, 'file' => 7, 'filter_format' => 7, 'image_style' => 6, @@ -91,7 +91,7 @@ protected function getEntityCounts() { 'node' => 18, // The 'book' module provides the 'book' node type, and the migration // creates 12 node types. - 'node_type' => 13, + 'node_type' => 14, 'rdf_mapping' => 7, 'search_page' => 2, 'shortcut' => 2, @@ -107,11 +107,11 @@ protected function getEntityCounts() { 'menu_link_content' => 10, 'view' => 16, 'date_format' => 11, - 'entity_form_display' => 29, + 'entity_form_display' => 31, 'entity_form_mode' => 1, - 'entity_view_display' => 58, + 'entity_view_display' => 61, 'entity_view_mode' => 14, - 'base_field_override' => 38, + 'base_field_override' => 41, ]; } @@ -122,7 +122,7 @@ protected function getEntityCountsIncremental() { $counts = $this->getEntityCounts(); $counts['block_content'] = 3; $counts['comment'] = 9; - $counts['entity_view_display'] = 58; + $counts['entity_view_display'] = 61; $counts['entity_view_mode'] = 14; $counts['file'] = 8; $counts['menu_link_content'] = 11; diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php index 665ed5b00be1..326e02aff379 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php @@ -78,21 +78,21 @@ protected function getEntityCounts() { 'comment' => 4, // The 'standard' profile provides the 'comment' comment type, and the // migration creates 6 comment types, one per node type. - 'comment_type' => 8, + 'comment_type' => 9, // Module 'language' comes with 'en', 'und', 'zxx'. Migration adds 'is' // and 'fr'. 'configurable_language' => 5, 'contact_form' => 3, 'contact_message' => 0, 'editor' => 2, - 'field_config' => 81, - 'field_storage_config' => 62, + 'field_config' => 84, + 'field_storage_config' => 63, 'file' => 3, 'filter_format' => 7, 'image_style' => 7, 'language_content_settings' => 22, 'node' => 7, - 'node_type' => 7, + 'node_type' => 8, 'rdf_mapping' => 8, 'search_page' => 2, 'shortcut' => 6, @@ -108,9 +108,9 @@ protected function getEntityCounts() { 'menu_link_content' => 12, 'view' => 16, 'date_format' => 11, - 'entity_form_display' => 22, + 'entity_form_display' => 24, 'entity_form_mode' => 1, - 'entity_view_display' => 33, + 'entity_view_display' => 36, 'entity_view_mode' => 14, 'base_field_override' => 4, ]; diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php index 2da622da2f98..98d32bf61689 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php @@ -47,7 +47,7 @@ public function testNode() { // Confirm there are only classic node migration map tables. This shows // that only the classic migration ran. $results = $this->nodeMigrateMapTableCount('6'); - $this->assertSame(13, $results['node']); + $this->assertSame(14, $results['node']); $this->assertSame(0, $results['node_complete']); $node = Node::load(1); $this->assertIdentical('1', $node->id(), 'Node 1 loaded.'); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php index a789e8dfb560..2e1e68a3971c 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php @@ -86,6 +86,10 @@ public function testNodeType() { $this->assertSame($expected_available_menus, $node_type_event->getThirdPartySetting('menu_ui', 'available_menus')); $expected_parent = 'navigation:'; $this->assertSame($expected_parent, $node_type_event->getThirdPartySetting('menu_ui', 'parent')); + + // Test the 32 character type name exists. + $node_type = NodeType::load('a_thirty_two_character_type_name'); + $this->assertSame('a_thirty_two_character_type_name', $node_type->id()); } } diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php index 153fd185da5b..c4da772b73b1 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php @@ -103,7 +103,7 @@ public function testNodeCompleteMigration() { // that only the complete migration ran. $results = $this->nodeMigrateMapTableCount('7'); $this->assertSame(0, $results['node']); - $this->assertSame(7, $results['node_complete']); + $this->assertSame(8, $results['node_complete']); $db = \Drupal::database(); $this->assertEquals($this->expectedNodeFieldRevisionTable(), $db->select('node_field_revision', 'nr') diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php index 4428bb906e64..fb61c3c62104 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -150,7 +150,7 @@ public function testNode() { // Confirm there are only classic node migration map tables. This shows // that only the classic migration ran. $results = $this->nodeMigrateMapTableCount('7'); - $this->assertSame(8, $results['node']); + $this->assertSame(9, $results['node']); $this->assertSame(0, $results['node_complete']); $this->assertEntity(1, 'test_content_type', 'en', 'An English Node', '2', TRUE, '1421727515', '1441032132', TRUE, FALSE); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php index e359611229a2..c44bf62081d6 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php @@ -80,6 +80,9 @@ public function testNodeType() { $this->assertEntity('book', 'Book page', '<em>Books</em> have a built-in hierarchical navigation. Use for handbooks or tutorials.', '', TRUE, TRUE, $expected_available_menus, $expected_parent, "Body"); $this->assertEntity('forum', 'Forum topic', 'A <em>forum topic</em> starts a new discussion thread within a forum.', 'No name-calling, no flame wars. Be nice.', TRUE, FALSE, $expected_available_menus, $expected_parent, 'Body'); $this->assertEntity('page', 'Basic page', "Use <em>basic pages</em> for your static content, such as an 'About us' page.", 'Help text for basic pages', FALSE, FALSE, $expected_available_menus, $expected_parent, "Body"); + // Test the 32 character type name exists. + $this->assertEntity('a_thirty_two_character_type_name', 'Test long name', '', '', TRUE, FALSE, NULL, NULL, "Body"); + // This node type does not carry a body field. $expected_available_menus = [ 'main-menu', -- GitLab