3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Tests the migration of comment entity displays from Drupal 6.
12 * @group migrate_drupal_6
14 class MigrateCommentEntityDisplayTest extends MigrateDrupal6TestBase {
19 public static $modules = ['comment', 'menu_ui'];
24 protected function setUp() {
26 $this->installConfig(['comment']);
27 $this->migrateContentTypes();
28 $this->executeMigrations([
32 'd6_comment_field_instance',
33 'd6_comment_entity_display',
38 * Asserts various aspects of a comment component in an entity view display.
42 * @param string $component_id
43 * The ID of the display component.
45 protected function assertDisplay($id, $component_id) {
46 $component = EntityViewDisplay::load($id)->getComponent($component_id);
47 $this->assertInternalType('array', $component);
48 $this->assertSame('hidden', $component['label']);
49 $this->assertSame('comment_default', $component['type']);
50 $this->assertSame(20, $component['weight']);
54 * Tests the migrated display configuration.
56 public function testMigration() {
57 $this->assertDisplay('node.article.default', 'comment_node_article');
58 $this->assertDisplay('node.company.default', 'comment_node_company');
59 $this->assertDisplay('node.employee.default', 'comment_node_employee');
60 $this->assertDisplay('node.event.default', 'comment_node_event');
61 $this->assertDisplay('node.forum.default', 'comment_forum');
62 $this->assertDisplay('node.page.default', 'comment_node_page');
63 $this->assertDisplay('node.sponsor.default', 'comment_node_sponsor');
64 $this->assertDisplay('node.story.default', 'comment_node_story');
65 $this->assertDisplay('node.test_event.default', 'comment_node_test_event');
66 $this->assertDisplay('node.test_page.default', 'comment_node_test_page');
67 $this->assertDisplay('node.test_planet.default', 'comment_node_test_planet');
68 $this->assertDisplay('node.test_story.default', 'comment_node_test_story');