3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
5 use Drupal\field\Entity\FieldStorageConfig;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Tests the migration of comment fields from Drupal 6.
12 * @group migrate_drupal_6
14 class MigrateCommentFieldTest extends MigrateDrupal6TestBase {
19 public static $modules = ['comment', 'menu_ui'];
24 protected function setUp() {
26 $this->installConfig(['comment']);
27 $this->executeMigrations([
34 * Asserts a comment field entity.
36 * @param string $comment_type
39 protected function assertEntity($comment_type) {
40 $entity = FieldStorageConfig::load('node.' . $comment_type);
41 $this->assertInstanceOf(FieldStorageConfig::class, $entity);
42 $this->assertSame('node', $entity->getTargetEntityTypeId());
43 $this->assertSame('comment', $entity->getType());
44 $this->assertSame($comment_type, $entity->getSetting('comment_type'));
48 * Tests the migrated comment fields.
50 public function testMigration() {
51 $this->assertEntity('comment_node_article');
52 $this->assertEntity('comment_node_company');
53 $this->assertEntity('comment_node_employee');
54 $this->assertEntity('comment_node_event');
55 $this->assertEntity('comment_forum');
56 $this->assertEntity('comment_node_page');
57 $this->assertEntity('comment_node_sponsor');
58 $this->assertEntity('comment_node_story');
59 $this->assertEntity('comment_node_test_event');
60 $this->assertEntity('comment_node_test_page');
61 $this->assertEntity('comment_node_test_planet');
62 $this->assertEntity('comment_node_test_story');