MigrateBlockContentEntityFormDisplayTest.php 1.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php

namespace Drupal\Tests\block_content\Kernel\Migrate;

use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;

/**
 * Tests migration of block content body field form display configuration.
 *
 * @group block_content
 */
class MigrateBlockContentEntityFormDisplayTest extends MigrateDrupal7TestBase {

  /**
   * {@inheritdoc}
   */
18
  public static $modules = ['block', 'block_content', 'filter', 'text'];
19 20 21 22 23 24

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
25
    $this->installEntitySchema('block_content');
26 27 28 29 30 31 32 33 34 35 36 37 38
    $this->installConfig(static::$modules);
    $this->executeMigrations([
      'block_content_type',
      'block_content_body_field',
      'block_content_entity_form_display',
    ]);
  }

  /**
   * Asserts a display entity.
   *
   * @param string $id
   *   The entity ID.
39
   * @param string $component_id
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
   *   The ID of the form component.
   */
  protected function assertDisplay($id, $component_id) {
    $component = EntityFormDisplay::load($id)->getComponent($component_id);
    $this->assertInternalType('array', $component);
    $this->assertSame('text_textarea_with_summary', $component['type']);
  }

  /**
   * Tests the migrated display configuration.
   */
  public function testMigration() {
    $this->assertDisplay('block_content.basic.default', 'body');
  }

}