public function MigrateCommentTest::testComments in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/Migrate/d6/MigrateCommentTest.php \Drupal\comment\Tests\Migrate\d6\MigrateCommentTest::testComments()
Tests the Drupal 6 to Drupal 8 comment migration.
File
- core/
modules/ comment/ src/ Tests/ Migrate/ d6/ MigrateCommentTest.php, line 56 - Contains \Drupal\comment\Tests\Migrate\d6\MigrateCommentTest.
Class
- MigrateCommentTest
- Upgrade comments.
Namespace
Drupal\comment\Tests\Migrate\d6Code
public function testComments() {
/** @var \Drupal\Core\Entity\EntityStorageInterface $comment_storage */
$comment_storage = $this->container
->get('entity.manager')
->getStorage('comment');
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $comment_storage
->load(1);
$this
->assertIdentical('The first comment.', $comment
->getSubject());
$this
->assertIdentical('The first comment body.', $comment->comment_body->value);
$this
->assertIdentical('filtered_html', $comment->comment_body->format);
$this
->assertIdentical('0', $comment->pid->target_id);
$this
->assertIdentical('1', $comment
->getCommentedEntityId());
$this
->assertIdentical('node', $comment
->getCommentedEntityTypeId());
$this
->assertIdentical('en', $comment
->language()
->getId());
$this
->assertIdentical('comment_no_subject', $comment
->getTypeId());
$comment = $comment_storage
->load(2);
$this
->assertIdentical('The response to the second comment.', $comment->subject->value);
$this
->assertIdentical('3', $comment->pid->target_id);
$comment = $comment_storage
->load(3);
$this
->assertIdentical('The second comment.', $comment->subject->value);
$this
->assertIdentical('0', $comment->pid->target_id);
}