3 namespace Drupal\Tests\block_content\Kernel\Migrate;
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\field\Entity\FieldStorageConfig;
7 use Drupal\field\FieldConfigInterface;
8 use Drupal\field\FieldStorageConfigInterface;
9 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
12 * Attaches a body field to the custom block type.
14 * @group block_content
16 class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
18 public static $modules = ['block', 'block_content', 'filter', 'text'];
23 protected function setUp() {
25 $this->installConfig(['block_content']);
26 $this->installEntitySchema('block_content');
27 $this->executeMigrations([
29 'block_content_body_field',
34 * Tests the block content body field migration.
36 public function testBlockContentBodyFieldMigration() {
37 /** @var \Drupal\field\FieldStorageConfigInterface $storage */
38 $storage = FieldStorageConfig::load('block_content.body');
39 $this->assertTrue($storage instanceof FieldStorageConfigInterface);
40 $this->assertIdentical('block_content', $storage->getTargetEntityTypeId());
41 $this->assertIdentical(['basic'], array_values($storage->getBundles()));
42 $this->assertIdentical('body', $storage->getName());
44 /** @var \Drupal\field\FieldConfigInterface $field */
45 $field = FieldConfig::load('block_content.basic.body');
46 $this->assertTrue($field instanceof FieldConfigInterface);
47 $this->assertIdentical('block_content', $field->getTargetEntityTypeId());
48 $this->assertIdentical('basic', $field->getTargetBundle());
49 $this->assertIdentical('body', $field->getName());
50 $this->assertIdentical('Body', $field->getLabel());