3 namespace Drupal\Tests\comment\Kernel\Migrate\d7;
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
9 * Tests the migration of comment entity displays from Drupal 7.
12 * @group migrate_drupal_7
14 class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase {
19 public static $modules = ['node', 'comment', 'text', 'menu_ui'];
24 protected function setUp() {
26 $this->installConfig(['comment', 'node']);
27 $this->executeMigrations([
31 'd7_comment_field_instance',
32 'd7_comment_entity_display',
37 * Asserts various aspects of a comment component in an entity view display.
41 * @param string $component_id
42 * The ID of the display component.
44 protected function assertDisplay($id, $component_id) {
45 $component = EntityViewDisplay::load($id)->getComponent($component_id);
46 $this->assertInternalType('array', $component);
47 $this->assertSame('hidden', $component['label']);
48 $this->assertSame('comment_default', $component['type']);
49 $this->assertSame(20, $component['weight']);
53 * Tests the migrated display configuration.
55 public function testMigration() {
56 $this->assertDisplay('node.page.default', 'comment_node_page');
57 $this->assertDisplay('node.article.default', 'comment_node_article');
58 $this->assertDisplay('node.book.default', 'comment_node_book');
59 $this->assertDisplay('node.blog.default', 'comment_node_blog');
60 $this->assertDisplay('node.forum.default', 'comment_forum');
61 $this->assertDisplay('node.test_content_type.default', 'comment_node_test_content_type');