8fed90584815fcb5bd5b54427bfa357e2f7dc25f
[yaffs-website] / web / core / modules / block_content / tests / src / Kernel / Migrate / MigrateBlockContentEntityFormDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\block_content\Kernel\Migrate;
4
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
7
8 /**
9  * Tests migration of block content body field form display configuration.
10  *
11  * @group block_content
12  */
13 class MigrateBlockContentEntityFormDisplayTest extends MigrateDrupal7TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['block', 'block_content', 'filter', 'text'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->installConfig(static::$modules);
26     $this->executeMigrations([
27       'block_content_type',
28       'block_content_body_field',
29       'block_content_entity_form_display',
30     ]);
31   }
32
33   /**
34    * Asserts a display entity.
35    *
36    * @param string $id
37    *   The entity ID.
38    * @param string $component_id
39    *   The ID of the form component.
40    */
41   protected function assertDisplay($id, $component_id) {
42     $component = EntityFormDisplay::load($id)->getComponent($component_id);
43     $this->assertInternalType('array', $component);
44     $this->assertSame('text_textarea_with_summary', $component['type']);
45   }
46
47   /**
48    * Tests the migrated display configuration.
49    */
50   public function testMigration() {
51     $this->assertDisplay('block_content.basic.default', 'body');
52   }
53
54 }