Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / d6 / MigrateCommentEntityFormDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
4
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Tests the migration of comment form display from Drupal 6.
10  *
11  * @group comment
12  * @group migrate_drupal_6
13  */
14 class MigrateCommentEntityFormDisplayTest extends MigrateDrupal6TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['comment', 'menu_ui'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp() {
25     parent::setUp();
26     $this->installConfig(['comment']);
27     $this->migrateContentTypes();
28     $this->executeMigrations([
29       'd6_comment_type',
30       'd6_comment_field',
31       'd6_comment_field_instance',
32       'd6_comment_entity_form_display',
33     ]);
34   }
35
36   /**
37    * Asserts various aspects of a comment component in an entity form display.
38    *
39    * @param string $id
40    *   The entity ID.
41    * @param string $component_id
42    *   The ID of the form component.
43    */
44   protected function assertDisplay($id, $component_id) {
45     $component = EntityFormDisplay::load($id)->getComponent($component_id);
46     $this->assertInternalType('array', $component);
47     $this->assertSame('comment_default', $component['type']);
48     $this->assertSame(20, $component['weight']);
49   }
50
51   /**
52    * Tests the migrated display configuration.
53    */
54   public function testMigration() {
55     $this->assertDisplay('node.article.default', 'comment_node_article');
56     $this->assertDisplay('node.company.default', 'comment_node_company');
57     $this->assertDisplay('node.employee.default', 'comment_node_employee');
58     $this->assertDisplay('node.event.default', 'comment_node_event');
59     $this->assertDisplay('node.forum.default', 'comment_forum');
60     $this->assertDisplay('node.page.default', 'comment_node_page');
61     $this->assertDisplay('node.sponsor.default', 'comment_node_sponsor');
62     $this->assertDisplay('node.story.default', 'comment_node_story');
63     $this->assertDisplay('node.test_event.default', 'comment_node_test_event');
64     $this->assertDisplay('node.test_page.default', 'comment_node_test_page');
65     $this->assertDisplay('node.test_planet.default', 'comment_node_test_planet');
66     $this->assertDisplay('node.test_story.default', 'comment_node_test_story');
67   }
68
69 }