3 namespace Drupal\Tests\comment\Kernel\Migrate\d7;
5 use Drupal\field\Entity\FieldStorageConfig;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
9 * Tests the migration of comment fields from Drupal 7.
12 * @group migrate_drupal_7
14 class MigrateCommentFieldTest extends MigrateDrupal7TestBase {
19 public static $modules = ['node', 'comment', 'text'];
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_page');
52 $this->assertEntity('comment_node_article');
53 $this->assertEntity('comment_node_blog');
54 $this->assertEntity('comment_node_book');
55 $this->assertEntity('comment_forum');
56 $this->assertEntity('comment_node_test_content_type');