Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / d7 / MigrateCommentEntityDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Migrate\d7;
4
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
7
8 /**
9  * Tests the migration of comment entity displays from Drupal 7.
10  *
11  * @group comment
12  * @group migrate_drupal_7
13  */
14 class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['node', 'comment', 'text', 'menu_ui'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp() {
25     parent::setUp();
26     $this->installConfig(['comment', 'node']);
27     $this->executeMigrations([
28       'd7_node_type',
29       'd7_comment_type',
30       'd7_comment_field',
31       'd7_comment_field_instance',
32       'd7_comment_entity_display',
33     ]);
34   }
35
36   /**
37    * Asserts various aspects of a comment component in an entity view display.
38    *
39    * @param string $id
40    *   The entity ID.
41    * @param string $component_id
42    *   The ID of the display component.
43    */
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']);
50   }
51
52   /**
53    * Tests the migrated display configuration.
54    */
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');
62   }
63
64 }