3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
5 use Drupal\comment\Entity\CommentType;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Tests the migration of comment types from Drupal 6.
12 * @group migrate_drupal_6
14 class MigrateCommentTypeTest extends MigrateDrupal6TestBase {
19 public static $modules = ['comment'];
24 protected function setUp() {
26 $this->installConfig(['comment']);
27 $this->executeMigration('d6_comment_type');
31 * Asserts a comment type entity.
35 * @param string $label
38 protected function assertEntity($id, $label) {
39 $entity = CommentType::load($id);
40 $this->assertInstanceOf(CommentType::class, $entity);
41 $this->assertSame($label, $entity->label());
42 $this->assertSame('node', $entity->getTargetEntityTypeId());
46 * Tests the migrated comment types.
48 public function testMigration() {
49 $this->assertEntity('comment_node_article', 'Article comment');
50 $this->assertEntity('comment_node_company', 'Company comment');
51 $this->assertEntity('comment_node_employee', 'Employee comment');
52 $this->assertEntity('comment_node_event', 'Event comment');
53 $this->assertEntity('comment_forum', 'Forum topic comment');
54 $this->assertEntity('comment_node_page', 'Page comment');
55 $this->assertEntity('comment_node_sponsor', 'Sponsor comment');
56 $this->assertEntity('comment_node_story', 'Story comment');
57 $this->assertEntity('comment_node_test_event', 'Migrate test event comment');
58 $this->assertEntity('comment_node_test_page', 'Migrate test page comment');
59 $this->assertEntity('comment_node_test_planet', 'Migrate test planet comment');
60 $this->assertEntity('comment_node_test_story', 'Migrate test story comment');