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 migration of comment display configuration.
13 class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase {
15 public static $modules = ['node', 'comment', 'text', 'menu_ui'];
20 protected function setUp() {
22 $this->installConfig(static::$modules);
23 $this->executeMigrations([
27 'd7_comment_field_instance',
28 'd7_comment_entity_display',
33 * Asserts a display entity.
37 * @param string $component_id
38 * The ID of the display component.
40 protected function assertDisplay($id, $component_id) {
41 $component = EntityViewDisplay::load($id)->getComponent($component_id);
42 $this->assertTrue(is_array($component));
43 $this->assertIdentical('hidden', $component['label']);
44 $this->assertIdentical('comment_default', $component['type']);
45 $this->assertIdentical(20, $component['weight']);
49 * Tests the migrated display configuration.
51 public function testMigration() {
52 $this->assertDisplay('node.page.default', 'comment_node_page');
53 $this->assertDisplay('node.article.default', 'comment_node_article');
54 $this->assertDisplay('node.book.default', 'comment_node_book');
55 $this->assertDisplay('node.blog.default', 'comment_node_blog');
56 $this->assertDisplay('node.forum.default', 'comment_node_forum');
57 $this->assertDisplay('node.test_content_type.default', 'comment_node_test_content_type');