Unverified Commit 642b7653 authored by alexpott's avatar alexpott
Browse files

Issue #3095922 by huzooka, Wim Leers, quietone, andypost: The comment...

Issue #3095922 by huzooka, Wim Leers, quietone, andypost: The comment "language" column in D7 might be empty after migrating from D6, this is invalid in D8
parent 5def5fc1
......@@ -40,7 +40,11 @@ process:
-
plugin: skip_on_empty
method: row
langcode: language
# Comments migrated from Drupal 6 to Drupal 7 may not have a language.
langcode:
plugin: default_value
source: language
default_value: und
field_name: '@comment_type'
subject: subject
uid: uid
......
......@@ -105,6 +105,26 @@ public function testMigration() {
$node = $comment->getCommentedEntity();
$this->assertInstanceOf(NodeInterface::class, $node);
$this->assertSame('2', $node->id());
// Tests a comment migrated from Drupal 6 to Drupal 7 that did not have a
// language.
$comment = Comment::load(4);
$this->assertInstanceOf(Comment::class, $comment);
$this->assertSame('Comment without language', $comment->getSubject());
$this->assertSame('1426781880', $comment->getCreatedTime());
$this->assertSame('1426781880', $comment->getChangedTime());
$this->assertTrue($comment->isPublished());
$this->assertSame('Bob', $comment->getAuthorName());
$this->assertSame('bob@local.host', $comment->getAuthorEmail());
$this->assertSame('A comment without language (migrated from Drupal 6)', $comment->comment_body->value);
$this->assertSame('filtered_html', $comment->comment_body->format);
$this->assertSame('drupal7.local', $comment->getHostname());
$this->assertSame('und', $comment->language()->getId());
$this->assertSame('10', $comment->field_integer->value);
$node = $comment->getCommentedEntity();
$this->assertInstanceOf(NodeInterface::class, $node);
$this->assertSame('1', $node->id());
}
/**
......
......@@ -2701,6 +2701,22 @@
'homepage' => '',
'language' => 'is',
))
->values(array(
'cid' => '4',
'pid' => '0',
'nid' => '1',
'uid' => '3',
'subject' => 'Comment without language',
'hostname' => 'drupal7.local',
'created' => '1426781880',
'changed' => '1426781880',
'status' => '1',
'thread' => '02/',
'name' => 'Bob',
'mail' => '',
'homepage' => '',
'language' => '',
))
->execute();
$connection->schema()->createTable('contact', array(
'fields' => array(
......@@ -3350,6 +3366,18 @@
'created' => '1531663925',
'changed' => '1531663925',
))
->values(array(
'entity_type' => 'comment',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'en',
'source' => '',
'uid' => '1',
'status' => '1',
'translate' => '0',
'created' => '1426781880',
'changed' => '1426781880',
))
->values(array(
'entity_type' => 'taxonomy_term',
'entity_id' => '4',
......@@ -5327,6 +5355,17 @@
'comment_body_value' => 'This is a comment to an Icelandic translation.',
'comment_body_format' => 'filtered_html',
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'und',
'delta' => '0',
'comment_body_value' => 'A comment without language (migrated from Drupal 6)',
'comment_body_format' => 'filtered_html',
))
->execute();
$connection->schema()->createTable('field_data_description_field', array(
'fields' => array(
......@@ -6927,6 +6966,16 @@
'delta' => '0',
'field_integer_value' => '1',
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'en',
'delta' => '0',
'field_integer_value' => '10',
))
->values(array(
'entity_type' => 'taxonomy_term',
'bundle' => 'test_vocabulary',
......@@ -10307,6 +10356,17 @@
'subject_field_value' => 'Comment to IS translation',
'subject_field_format' => NULL,
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'en',
'delta' => '0',
'subject_field_value' => 'Comment without language',
'subject_field_format' => NULL,
))
->execute();
$connection->schema()->createTable('field_data_taxonomy_forums', array(
'fields' => array(
......@@ -10818,6 +10878,17 @@
'comment_body_value' => 'This is a comment to an Icelandic translation.',
'comment_body_format' => 'filtered_html',
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'und',
'delta' => '0',
'comment_body_value' => 'A comment without language (migrated from Drupal 6)',
'comment_body_format' => 'filtered_html',
))
->execute();
$connection->schema()->createTable('field_revision_description_field', array(
'fields' => array(
......@@ -12423,6 +12494,16 @@
'delta' => '0',
'field_integer_value' => '99',
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'en',
'delta' => '0',
'field_integer_value' => '10',
))
->values(array(
'entity_type' => 'taxonomy_term',
'bundle' => 'test_vocabulary',
......@@ -15833,6 +15914,17 @@
'subject_field_value' => 'Comment to IS translation',
'subject_field_format' => NULL,
))
->values(array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '4',
'revision_id' => '4',
'language' => 'en',
'delta' => '0',
'subject_field_value' => 'Comment without language',
'subject_field_format' => NULL,
))
->execute();
$connection->schema()->createTable('field_revision_taxonomy_forums', array(
'fields' => array(
......@@ -42509,11 +42601,11 @@
))
->values(array(
'nid' => '1',
'cid' => '1',
'last_comment_timestamp' => '1421727536',
'cid' => '4',
'last_comment_timestamp' => '1426781880',
'last_comment_name' => '',
'last_comment_uid' => '1',
'comment_count' => '1',
'last_comment_uid' => '3',
'comment_count' => '2',
))
->values(array(
'nid' => '3',
......@@ -64,7 +64,7 @@ protected function getEntityCounts() {
'block' => 25,
'block_content' => 1,
'block_content_type' => 1,
'comment' => 3,
'comment' => 4,
// The 'standard' profile provides the 'comment' comment type, and the
// migration creates 6 comment types, one per node type.
'comment_type' => 7,
......@@ -111,7 +111,7 @@ protected function getEntityCounts() {
protected function getEntityCountsIncremental() {
$counts = $this->getEntityCounts();
$counts['block_content'] = 2;
$counts['comment'] = 4;
$counts['comment'] = 5;
$counts['file'] = 4;
$counts['menu_link_content'] = 13;
$counts['node'] = 7;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment