public function MigrateCommentTest::testCommentMigration in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/Migrate/d7/MigrateCommentTest.php \Drupal\comment\Tests\Migrate\d7\MigrateCommentTest::testCommentMigration()
Tests migration of comments from Drupal 7.
File
- core/
modules/ comment/ src/ Tests/ Migrate/ d7/ MigrateCommentTest.php, line 57 - Contains \Drupal\comment\Tests\Migrate\d7\MigrateCommentTest.
Class
- MigrateCommentTest
- Tests migration of comments from Drupal 7.
Namespace
Drupal\comment\Tests\Migrate\d7Code
public function testCommentMigration() {
$comment = Comment::load(1);
$this
->assertTrue($comment instanceof CommentInterface);
/** @var \Drupal\comment\CommentInterface $comment */
$this
->assertIdentical('A comment', $comment
->getSubject());
$this
->assertIdentical('1421727536', $comment
->getCreatedTime());
$this
->assertIdentical('1421727536', $comment
->getChangedTime());
$this
->assertTrue($comment
->getStatus());
$this
->assertIdentical('admin', $comment
->getAuthorName());
$this
->assertIdentical('admin@local.host', $comment
->getAuthorEmail());
$this
->assertIdentical('This is a comment', $comment->comment_body->value);
$this
->assertIdentical('filtered_html', $comment->comment_body->format);
$node = $comment
->getCommentedEntity();
$this
->assertTrue($node instanceof NodeInterface);
$this
->assertIdentical('1', $node
->id());
}