+
+ // Tests that the language of the comment is migrated from the node.
+ $comment = Comment::load(7);
+ $this->assertSame('Comment to John Smith - EN', $comment->subject->value);
+ $this->assertSame('This is an English comment.', $comment->comment_body->value);
+ $this->assertSame('21', $comment->getCommentedEntityId());
+ $this->assertSame('node', $comment->getCommentedEntityTypeId());
+ $this->assertSame('en', $comment->language()->getId());
+
+ $node = $comment->getCommentedEntity();
+ $this->assertInstanceOf(NodeInterface::class, $node);
+ $this->assertSame('21', $node->id());
+
+ // Tests that the comment language is correct and that the commented entity
+ // is correctly migrated when the comment was posted to a node translation.
+ $comment = Comment::load(8);
+ $this->assertSame('Comment to John Smith - FR', $comment->subject->value);
+ $this->assertSame('This is a French comment.', $comment->comment_body->value);
+ $this->assertSame('21', $comment->getCommentedEntityId());
+ $this->assertSame('node', $comment->getCommentedEntityTypeId());
+ $this->assertSame('fr', $comment->language()->getId());
+
+ $node = $comment->getCommentedEntity();
+ $this->assertInstanceOf(NodeInterface::class, $node);
+ $this->assertSame('21', $node->id());