Version 1
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / d7 / MigrateCommentEntityFormDisplaySubjectTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Migrate\d7;
4
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
7
8 /**
9  * Tests migration of comment form's subject display configuration.
10  *
11  * @group comment
12  */
13 class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase {
14
15   public static $modules = ['node', 'comment', 'text', 'menu_ui'];
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function setUp() {
21     parent::setUp();
22     $this->installConfig(static::$modules);
23     $this->executeMigrations([
24       'd7_node_type',
25       'd7_comment_type',
26       'd7_comment_entity_form_display_subject',
27     ]);
28   }
29
30   /**
31    * Asserts a display entity.
32    *
33    * @param string $id
34    *   The entity ID.
35    */
36   protected function assertDisplay($id) {
37     $component = EntityFormDisplay::load($id)->getComponent('subject');
38     $this->assertTrue(is_array($component));
39     $this->assertIdentical('string_textfield', $component['type']);
40     $this->assertIdentical(10, $component['weight']);
41   }
42
43   /**
44    * Tests the migrated display configuration.
45    */
46   public function testMigration() {
47     $this->assertDisplay('comment.comment_node_page.default');
48     $this->assertDisplay('comment.comment_node_article.default');
49     $this->assertDisplay('comment.comment_node_book.default');
50     $this->assertDisplay('comment.comment_node_blog.default');
51     $this->assertDisplay('comment.comment_node_forum.default');
52     $this->assertDisplay('comment.comment_node_test_content_type.default');
53   }
54
55 }