diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php index 981b54e..26e4f3d 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php @@ -44,6 +44,13 @@ class EntityComment extends EntityContentBase { protected $stubCommentedEntityType; /** + * The comment type used for 'comment_type' in stub rows. + * + * @var string + */ + protected $stubCommentedCommentType; + + /** * Builds an comment entity destination. * * @param array $configuration @@ -116,6 +123,9 @@ protected function getEntity(Row $row, array $old_destination_id_values) { $this->stubCommentedEntityId = $result[0]['nid_min']; $this->stubCommentedEntityType = 'node'; } + // Add a stub comment_type. + $this->stubCommentedCommentType = 'comment'; + // Figure out a working } if (!empty($this->stubCommentedEntityId)) { $row->setDestinationProperty('entity_id', $this->stubCommentedEntityId); diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php index 77980cd..830beea 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php @@ -19,7 +19,7 @@ */ class MigrateCommentTest extends MigrateDrupalTestBase { - static $modules = array('node', 'comment'); + static $modules = array('node', 'comment', 'rdf'); /** * {@inheritdoc} @@ -54,7 +54,12 @@ protected function setUp() { 'd6_comment_entity_form_display' => array(array(array('story'), array('node', 'story', 'default', 'comment'))), ); $this->prepareMigrations($id_mappings); + } + /** + * Tests the Drupal 6 to Drupal 8 comment migration. + */ + public function testComments() { \Drupal::service('comment.manager')->addDefaultField('node', 'story'); /** @var \Drupal\migrate\entity\Migration $migration */ $migration = entity_load('migration', 'd6_comment'); @@ -67,12 +72,7 @@ protected function setUp() { $this->prepare($migration, $dumps); $executable = new MigrateExecutable($migration, $this); $executable->import(); - } - /** - * Tests the Drupal 6 to Drupal 8 comment migration. - */ - public function testComments() { /** @var \Drupal\comment\CommentInterface $comment */ $comment = entity_load('comment', 1); $this->assertEqual('The first comment.', $comment->getSubject());